[WSS4J] wss4j/interop/org/apache/ws/axis/oasis Scenario7.java,NONE,1.1

[email protected] Fri, 16 Jan 2004 07:19:40 -0800
Newsgroups gmane.text.xml.wss4j
Message-ID <[email protected]>
Update of /cvsroot/wss4j/wss4j/interop/org/apache/ws/axis/oasis
In directory sc8-pr-cvs1:/tmp/cvs-serv25088/interop/org/apache/ws/axis/oasis

Added Files:
	Scenario7.java 
Log Message:
Add support for interop scenario#7. Not yet in package tests. Perparing STR-Transform
test.

--- NEW FILE: Scenario7.java ---
package org.apache.ws.axis.oasis;

import org.apache.axis.utils.Options;
import org.apache.ws.axis.oasis.ping.PingPort;
import org.apache.ws.axis.oasis.ping.PingServiceLocator;
import org.apache.ws.axis.oasis.ping.TicketType;

/**
 * Class Scenario6
 */
public class Scenario7 {

    /** Field address */
    private static final java.lang.String address =
            "http://localhost:9080/axis/services/Ping7";

    /**
     * Method main
     * 
     * @param args 
     * @throws Exception 
     */
    public static void main(String[] args) throws Exception {

        Options opts = new Options(args);
        opts.setDefaultURL(address);

        /*
         *     Start to prepare service call. Once this is done, several
         *     calls can be made on the port (see below)
         *
         *     Fist: get the service locator. This implements the functionality
         *     to get a client stub (aka port).
         */
        PingServiceLocator service = new PingServiceLocator();

        /*
         *     this is a JAX-RPC compliant call. It uses a preconfigured
         *     endpoint address (usually contained in the WSDL). Note the
         *     cast.
         *    
         * SecPort port = (SwaPort)service.getPort(SwaPortType.class);
         */

        /*
         *     Here we use an Axis specific call that allows to override the
         *     port address (service endpoint address) with an own URL. Comes
         *     in handy for testing.
         */
        java.net.URL endpoint;

        try {
            endpoint = new java.net.URL(opts.getURL());
        } catch (java.net.MalformedURLException e) {
            throw new javax.xml.rpc.ServiceException(e);
        }

        PingPort port = (PingPort) service.getPing6(endpoint);

        /*
         *     At this point all preparations are done. Using the port we can
         *     now perform as many calls as necessary.
         */

        // perform call
        TicketType ticket = new TicketType("scenario7");
        javax.xml.rpc.holders.StringHolder text =
                new javax.xml.rpc.holders.StringHolder("Scenario 7 text");

        port.ping(text, ticket);
        System.out.println(text.value);

        if (opts.isFlagSet('t') > 0) {
            long startTime = System.currentTimeMillis();

            for (int i = 0; i < 20; i++) {
                port.ping(text, ticket);
            }

            long endTime = System.currentTimeMillis();

            System.out.println("Time used: " + (endTime - startTime) + "ms");
        }
    }
}




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn