axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r365867 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/client/ core/src/org/apache/axis2/context/ core/src/org/apache/axis2/description/ integration/src/test/interop/whitemesa/round1/ integration/src/test/interop/whit...
Date Wed, 04 Jan 2006 09:01:49 GMT
Author: deepal
Date: Wed Jan  4 01:01:18 2006
New Revision: 365867

URL: http://svn.apache.org/viewcvs?rev=365867&view=rev
Log:
integrating ServiceClinet into sample and test cases 
changed private static variable in ServiceClient into public 

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
    webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round1/Round1Client.java
    webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round2/SunRound2Client.java
    webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round3/SunRound3Client.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
    webservices/axis2/trunk/java/modules/samples/src/sample/amazon/search/AsynchronousClient.java
    webservices/axis2/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java
    webservices/axis2/trunk/java/modules/samples/src/sample/sgccalculator/CalcClient.java
    webservices/axis2/trunk/java/modules/samples/src/userguide/clients/ClientSideModuleEngagement.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
Wed Jan  4 01:01:18 2006
@@ -3,17 +3,9 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.async.AsyncResult;
 import org.apache.axis2.client.async.Callback;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ServiceGroupContext;
+import org.apache.axis2.context.*;
 import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.OutInAxisOperation;
-import org.apache.axis2.description.OutOnlyAxisOperation;
-import org.apache.axis2.description.RobustOutOnlyAxisOperation;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMAbstractFactory;
@@ -37,15 +29,15 @@
 public class ServiceClient {
 
     // service and operation names used for anonymously stuff
-    private static final String ANON_SERVICE = "__ANONYMOUS_SERVICE__";
+    public static final String ANON_SERVICE = "__ANONYMOUS_SERVICE__";
 
-    private static final QName ANON_OUT_ONLY_OP = new QName(
+    public static final QName ANON_OUT_ONLY_OP = new QName(
             "__OPERATION_OUT_ONLY__");
 
-    private static final QName ANON_ROBUST_OUT_ONLY_OP = new QName(
+    public static final QName ANON_ROBUST_OUT_ONLY_OP = new QName(
             "__OPERATION_ROBUST_OUT_ONLY__");
 
-    private static final QName ANON_OUT_IN_OP = new QName(
+    public static final QName ANON_OUT_IN_OP = new QName(
             "__OPERATION_OUT_IN__");
 
     // the metadata for the service that I'm clienting for
@@ -73,22 +65,19 @@
      * If this service is already in the world that's handed in (in the form of
      * a ConfigurationContext) then I will happily work in it. If not I will
      * create a small little virtual world and live there.
-     * 
-     * @param configContext
-     *            The configuration context under which this service lives (may
-     *            be null, in which case a new local one will be created)
-     * @param axisService
-     *            The service for which this is the client.
-     * @throws AxisFault
-     *             if something goes wrong while creating a config context (if
-     *             needed)
+     *
+     * @param configContext The configuration context under which this service lives (may
+     *                      be null, in which case a new local one will be created)
+     * @param axisService   The service for which this is the client.
+     * @throws AxisFault if something goes wrong while creating a config context (if
+     *                   needed)
      */
     public ServiceClient(ConfigurationContext configContext,
-            AxisService axisService) throws AxisFault {
+                         AxisService axisService) throws AxisFault {
         // create a config context if needed
         this.configContext = (configContext != null) ? configContext
                 : new ConfigurationContextFactory()
-                        .buildConfigurationContext(null);
+                .buildConfigurationContext(null);
 
         // save the axisConfig and service
         this.axisConfig = this.configContext.getAxisConfiguration();
@@ -103,7 +92,7 @@
         // create a service context for myself: create a new service group
         // context and then get the service context for myself as I'll need that
         // later for stuff that I gotta do
-        ServiceGroupContext sgc = new ServiceGroupContext(configContext,
+        ServiceGroupContext sgc = new ServiceGroupContext(this.configContext,
                 this.axisService.getParent());
         this.serviceContext = sgc.getServiceContext(this.axisService);
     }
@@ -111,24 +100,19 @@
     /**
      * Create a service client for WSDL service identified by the QName of the
      * wsdl:service element in a WSDL document.
-     * 
-     * @param configContext
-     *            The configuration context under which this service lives (may
-     *            be null, in which case a new local one will be created) *
-     * @param wsdlURL
-     *            The URL of the WSDL document to read
-     * @param wsdlServiceName
-     *            The QName of the WSDL service in the WSDL document to create a
-     *            client for
-     * @param portName
-     *            The name of the WSDL 1.1 port to create a client for. May be
-     *            null (if WSDL 2.0 is used or if only one port is there). .
-     * @throws AxisFault
-     *             if something goes wrong while creating a config context (if
-     *             needed)
+     *
+     * @param configContext   The configuration context under which this service lives (may
+     *                        be null, in which case a new local one will be created) *
+     * @param wsdlURL         The URL of the WSDL document to read
+     * @param wsdlServiceName The QName of the WSDL service in the WSDL document to create
a
+     *                        client for
+     * @param portName        The name of the WSDL 1.1 port to create a client for. May be
+     *                        null (if WSDL 2.0 is used or if only one port is there). .
+     * @throws AxisFault if something goes wrong while creating a config context (if
+     *                   needed)
      */
     public ServiceClient(ConfigurationContext configContext, URL wsdlURL,
-            QName wsdlServiceName, String portName) throws AxisFault {
+                         QName wsdlServiceName, String portName) throws AxisFault {
         // TODO: Srinath to write this code :)
         throw new UnsupportedOperationException(
                 "ServiceClient currently does not support direct WSDL construction");
@@ -146,10 +130,9 @@
      * Create an anonymous axisService with one (anonymous) operation each for
      * each MEP that I support dealing with anonymously using the convenience
      * APIs.
-     * 
+     *
      * @return the minted anonymous service
-     * @throws AxisFault
-     *             if smething goes wrong
+     * @throws AxisFault if smething goes wrong
      */
     private AxisService createAnonymousService() throws AxisFault {
         // now add anonymous operations to the axis service for use with the
@@ -183,7 +166,7 @@
      * Return the AxisService this is a client for. This is primarily useful
      * when the AxisService is created anonymously or from WSDL as otherwise the
      * user had the AxisService to start with.
-     * 
+     *
      * @return the axisService
      */
     public AxisService getAxisService() {
@@ -199,7 +182,7 @@
 
     /**
      * Get the client configuration from this service interaction.
-     * 
+     *
      * @return set of options set earlier.
      */
     public Options getOptions() {
@@ -208,11 +191,9 @@
 
     /**
      * Engage a module for this service client.
-     * 
-     * @param moduleName
-     *            Name of the module to engage
-     * @throws AxisFault
-     *             if something goes wrong
+     *
+     * @param moduleName Name of the module to engage
+     * @throws AxisFault if something goes wrong
      */
     public void engageModule(QName moduleName) throws AxisFault {
         axisService.engageModule(axisConfig.getModule(moduleName), axisConfig);
@@ -222,9 +203,8 @@
      * Add an XML element as a header to be sent with interactions. This allows
      * users to go a bit beyond the dirt simple XML in/out pattern using this
      * simplified API. A header
-     * 
-     * @param header
-     *            The header to be added for interactions. Must not be null.
+     *
+     * @param header The header to be added for interactions. Must not be null.
      */
     public void addHeader(OMElement header) {
         if (headers == null) {
@@ -236,7 +216,7 @@
     /**
      * Add a simple header consisting of some text (and a header name; duh) to
      * be sent with interactions.
-     * 
+     *
      * @param headerName
      * @param headerText
      */
@@ -253,12 +233,10 @@
      * possibly receive a fault. If you need more control over this interaction
      * then you need to create a client (@see createClient()) for the operation
      * and use that instead.
-     * 
-     * @param elem
-     *            The XML to send
-     * @throws AxisFault
-     *             if something goes wrong while sending it or if a fault is
-     *             received in response (per the Robust In-Only MEP).
+     *
+     * @param elem The XML to send
+     * @throws AxisFault if something goes wrong while sending it or if a fault is
+     *                   received in response (per the Robust In-Only MEP).
      */
     public void sendRobust(OMElement elem) throws AxisFault {
         sendRobust(ANON_ROBUST_OUT_ONLY_OP, elem);
@@ -270,14 +248,11 @@
      * possibly receive a fault under the guise of a specific operation. If you
      * need more control over this interaction then you need to create a client
      * (@see createClient()) for the operation and use that instead.
-     * 
-     * @param operation
-     *            The name of the operation to use. Must NOT be null.
-     * @param elem
-     *            The XML to send
-     * @throws AxisFault
-     *             if something goes wrong while sending it or if a fault is
-     *             received in response (per the Robust In-Only MEP).
+     *
+     * @param operation The name of the operation to use. Must NOT be null.
+     * @param elem      The XML to send
+     * @throws AxisFault if something goes wrong while sending it or if a fault is
+     *                   received in response (per the Robust In-Only MEP).
      */
     public void sendRobust(QName operation, OMElement elem) throws AxisFault {
         // look up the appropriate axisop and create the client
@@ -301,11 +276,9 @@
      * a service operation who's MEP is In-Only. That is, there is no
      * opportunity to get an error from the service via this API; one may still
      * get client-side errors, such as host unknown etc.
-     * 
-     * @param elem
-     *            The XML element to send to the service
-     * @throws AxisFault
-     *             If something goes wrong trying to send the XML
+     *
+     * @param elem The XML element to send to the service
+     * @throws AxisFault If something goes wrong trying to send the XML
      */
     public void fireAndForget(OMElement elem) throws AxisFault {
         fireAndForget(ANON_OUT_ONLY_OP, elem);
@@ -317,13 +290,10 @@
      * MEP is In-Only. That is, there is no opportunity to get an error from the
      * service via this API; one may still get client-side errors, such as host
      * unknown etc.
-     * 
-     * @param operation
-     *            The operation to send fire the message under
-     * @param elem
-     *            The XML element to send to the service
-     * @throws AxisFault
-     *             If something goes wrong trying to send the XML
+     *
+     * @param operation The operation to send fire the message under
+     * @param elem      The XML element to send to the service
+     * @throws AxisFault If something goes wrong trying to send the XML
      */
     public void fireAndForget(QName operation, OMElement elem) throws AxisFault {
         // look up the appropriate axisop and create the client
@@ -411,7 +381,7 @@
             OperationClient mepClient = createClient(operation);
             mepClient.setOptions(options);
             mepClient.addMessageContext(mc);
-            mepClient.execute(false);
+            mepClient.execute(true);
             MessageContext response = mepClient
                     .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
             return response.getEnvelope().getBody().getFirstElement();
@@ -424,7 +394,7 @@
     }
 
     public void sendReceiveNonBlocking(QName operation, OMElement elem,
-            Callback callback) throws AxisFault {
+                                       Callback callback) throws AxisFault {
         MessageContext mc = new MessageContext();
         fillSoapEnvelope(mc, elem);
 
@@ -443,7 +413,7 @@
             axisService.getOperation(operation).setMessageReceiver(
                     callbackReceiver);
         }
-        mepClient.execute(true);
+        mepClient.execute(false);
     }
 
     /**
@@ -453,13 +423,11 @@
      * you're doing and need the full capabilities of Axis2's client
      * architecture. This is meant for people with deep skin and not the light
      * user.
-     * 
-     * @param operation
-     *            The QName of the operation to create a client for.
+     *
+     * @param operation The QName of the operation to create a client for.
      * @return a MEP client configured to talk to the given operation or null if
      *         the operation name is not found.
-     * @throws AxisFault
-     *             if the operation is not found or something else goes wrong
+     * @throws AxisFault if the operation is not found or something else goes wrong
      */
     public OperationClient createClient(QName operation) throws AxisFault {
         AxisOperation axisOp = axisService.getOperation(operation);
@@ -472,7 +440,7 @@
     /**
      * This will close the out put stream or , and remove entry from waiting
      * queue of the transport Listener queue
-     * 
+     *
      * @throws AxisFault
      */
     public void finalizeInvoke() throws AxisFault {
@@ -486,7 +454,7 @@
     /**
      * Return the SOAP factory to use depending on what options have been set
      * (or default to SOAP 1.1)
-     * 
+     *
      * @return the SOAP factory
      */
     private SOAPFactory getSOAPFactory() {
@@ -500,10 +468,17 @@
     }
 
     /**
-     * Create a message ID for the given message context if needed.
-     * 
-     * @param mc
-     *            the message context whose id is to be set
+     * Create a message ID for the given message context if needed. If user gives an option
with
+     * MessageID then just copy that into MessageContext , and with that there can be mutiple
+     * message with same MessageID unless user call setOption for each invocation.
+     * <p/>
+     * If user want to give message ID then the better way is to set the message ID in the
option and
+     * call setOption for each invocation then the right thing will happen.
+     * <p/>
+     * If user does not give a message ID then the new one will be created and set that into
Message
+     * Context.
+     *
+     * @param mc the message context whose id is to be set
      */
     private void setMessageID(MessageContext mc) {
         // now its the time to put the parameters set by the user in to the
@@ -512,20 +487,16 @@
         String messageId = options.getMessageId();
         if (messageId == null || "".equals(messageId)) {
             messageId = UUIDGenerator.getUUID();
-            options.setMessageId(messageId);
         }
         mc.setMessageID(messageId);
     }
 
     /**
      * Prepare a SOAP envelope with the stuff to be sent.
-     * 
-     * @param mc
-     *            the message context to be filled
-     * @param elem
-     *            the payload content
-     * @throws AxisFault
-     *             if something goes wrong
+     *
+     * @param mc   the message context to be filled
+     * @param elem the payload content
+     * @throws AxisFault if something goes wrong
      */
     private void fillSoapEnvelope(MessageContext mc, OMElement elem)
             throws AxisFault {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
Wed Jan  4 01:01:18 2006
@@ -22,6 +22,7 @@
 import java.util.Iterator;
 
 public class ConfigurationContextFactory {
+    
     private Log log = LogFactory.getLog(getClass());
 
     /**

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/OutInAxisOperation.java
Wed Jan  4 01:01:18 2006
@@ -242,7 +242,7 @@
         else
 
         {
-            if (!block) {
+            if (block) {
                 // Send the SOAP Message and receive a response
                 MessageContext response = send(mc, options
                         .getTransportInDescription());
@@ -328,7 +328,6 @@
             throw new AxisFault(Messages
                     .getMessage("blockingInvocationExpectsResponse"));
         }
-
         return responseMessageContext;
     }
 

Modified: webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round1/Round1Client.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round1/Round1Client.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round1/Round1Client.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round1/Round1Client.java
Wed Jan  4 01:01:18 2006
@@ -19,14 +19,17 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.OutInAxisOperation;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.wsdl.WSDLConstants;
 import test.interop.whitemesa.round1.util.Round1ClientUtil;
 
 import javax.xml.namespace.QName;
@@ -38,8 +41,8 @@
 
     public SOAPEnvelope sendMsg(Round1ClientUtil util, String epUrl, String soapAction) throws
AxisFault {
 
-        SOAPEnvelope retEnv = null;
-        URL url = null;
+        SOAPEnvelope retEnv;
+        URL url;
         try {
             url = new URL(epUrl);
         } catch (MalformedURLException e) {
@@ -52,9 +55,9 @@
         options.setTo(new EndpointReference(url.toString()));
         options.setSoapAction(soapAction);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-
-        Call call = new Call(clientHome);
-        call.setClientOptions(options);
+        ConfigurationContext configContext =
+                new ConfigurationContextFactory().buildConfigurationContext(clientHome);
+        ServiceClient serviceClient = new ServiceClient(configContext, null);
         SOAPEnvelope reqEnv = util.getEchoSoapEnvelope();
 
 
@@ -67,8 +70,11 @@
         QName opName = new QName("");
         AxisOperation opDesc = new OutInAxisOperation();
         opDesc.setName(opName);
-        MessageContext retMsgCtx = call.invokeBlocking(opDesc, msgCtx);
-        //SOAPEnvelope responseEnvelop = replyContext.getEnvelope();
+        OperationClient opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+        opClient.setOptions(options);
+        opClient.execute(true);
+        opClient.addMessageContext(msgCtx);
+        MessageContext retMsgCtx = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
         retEnv = retMsgCtx.getEnvelope();
 
         return retEnv;

Modified: webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round2/SunRound2Client.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round2/SunRound2Client.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round2/SunRound2Client.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round2/SunRound2Client.java
Wed Jan  4 01:01:18 2006
@@ -19,14 +19,15 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.OutInAxisOperation;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.wsdl.WSDLConstants;
 import test.interop.whitemesa.round2.util.SunRound2ClientUtil;
 
 import java.net.URL;
@@ -35,15 +36,12 @@
 
     public static SOAPEnvelope sendMsg(SunRound2ClientUtil util, String epUrl, String soapAction)
throws AxisFault {
 
-        SOAPEnvelope resEnv = null;
-        Call call = null;
-        URL url = null;
+        SOAPEnvelope resEnv;
+        URL url;
         try {
-            call = new Call("target/test-resources/integrationRepo");
             url = new URL(epUrl);
 
             Options options = new Options();
-            call.setClientOptions(options);
             options.setTo(new EndpointReference(url.toString()));
             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
             options.setSoapAction(soapAction);
@@ -51,10 +49,19 @@
             AxisConfiguration axisConfig = new AxisConfiguration();
             ConfigurationContext configCtx = new ConfigurationContext(axisConfig);
             MessageContext msgCtx = new MessageContext(configCtx);
-            AxisOperation opDesc = new OutInAxisOperation();
             SOAPEnvelope requestEnvilope = util.getEchoSoapEnvelope();
             msgCtx.setEnvelope(requestEnvilope);
-            MessageContext responseMCtx = call.invokeBlocking(opDesc, msgCtx);
+
+            ConfigurationContext configContext =
+                    new ConfigurationContextFactory().buildConfigurationContext(
+                            "target/test-resources/integrationRepo");
+            ServiceClient serviceClient = new ServiceClient(configContext, null);
+            serviceClient.setOptions(options);
+            OperationClient opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+            opClient.addMessageContext(msgCtx);
+            opClient.setOptions(options);
+            MessageContext responseMCtx = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
             resEnv = responseMCtx.getEnvelope();
 
         } catch (Exception e) {

Modified: webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round3/SunRound3Client.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round3/SunRound3Client.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round3/SunRound3Client.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/src/test/interop/whitemesa/round3/SunRound3Client.java
Wed Jan  4 01:01:18 2006
@@ -19,14 +19,15 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.OutInAxisOperation;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.wsdl.WSDLConstants;
 import test.interop.whitemesa.round3.util.SunRound3ClientUtil;
 
 import java.net.URL;
@@ -34,17 +35,13 @@
 public class SunRound3Client {
 
     public SOAPEnvelope sendMsg(SunRound3ClientUtil util, String epUrl, String soapAction)
throws AxisFault {
-
-        SOAPEnvelope retEnvelope = null;
-        Call call = null;
-        URL url = null;
+        SOAPEnvelope retEnvelope;
+        URL url;
         try {
-            call = new Call("target/test-resources/integrationRepo");
             //todo set the path to repository in Call()
             url = new URL(epUrl);
 
             Options options = new Options();
-            call.setClientOptions(options);
             options.setTo(new EndpointReference(url.toString()));
             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
             options.setSoapAction(soapAction);
@@ -53,10 +50,18 @@
             ConfigurationContext configCtx = new ConfigurationContext(axisConfig);
             MessageContext msgCtx = new MessageContext(configCtx);
 
-            AxisOperation opDesc = new OutInAxisOperation();
             SOAPEnvelope requestEnvilope = util.getEchoSoapEnvelope();
             msgCtx.setEnvelope(requestEnvilope);
-            MessageContext resMsgCtx = call.invokeBlocking(opDesc, msgCtx);
+
+            ConfigurationContext configContext =
+                    new ConfigurationContextFactory().buildConfigurationContext(
+                            "target/test-resources/integrationRepo");
+            ServiceClient serviceClient = new ServiceClient(configContext, null);
+            serviceClient.setOptions(options);
+            OperationClient opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+            opClient.addMessageContext(msgCtx);
+            opClient.setOptions(options);
+            MessageContext resMsgCtx = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
             retEnvelope = resMsgCtx.getEnvelope();
 
         } catch (Exception e) {

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/tcp/TCPEchoRawXMLTest.java
Wed Jan  4 01:01:18 2006
@@ -21,6 +21,7 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.client.async.AsyncResult;
@@ -43,6 +44,7 @@
 import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLOutputFactory;
@@ -190,9 +192,7 @@
         ConfigurationContext configContext = confac.buildConfigurationContext(Constants.TESTING_REPOSITORY);
 
         AxisOperation opdesc = new OutInAxisOperation(new QName("echoOMElement"));
-        org.apache.axis2.client.Call call = new org.apache.axis2.client.Call(Constants.TESTING_REPOSITORY);
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(targetEPR);
         options.setAction(operationName.getLocalPart());
         options.setTransportInProtocol(Constants.TRANSPORT_TCP);
@@ -209,21 +209,23 @@
         envelope.getBody().addChild(method);
 
         MessageContext requestContext = new MessageContext(configContext);
-        AxisService srevice = new AxisService(serviceName.getLocalPart());
-        srevice.addOperation(opdesc);
-        configContext.getAxisConfiguration().addService(srevice);
-        requestContext.setAxisService(service);
+        requestContext.setAxisService(clientService);
         requestContext.setAxisOperation(opdesc);
-
-        //  requestContext.setTo(targetEPR);
-
         requestContext.setEnvelope(envelope);
-        call.invokeBlocking(opdesc, requestContext);
 
-        SOAPEnvelope env = call.invokeBlocking("echoOMElement", envelope);
-//        SOAPEnvelope env=  res.getEnvelope();
+        ServiceClient sender = new ServiceClient(configContext, clientService);
+        sender.setOptions(options);
+        OperationClient opClient = sender.createClient(new QName("echoOMElement"));
+        opClient.addMessageContext(requestContext);
+        opClient.setOptions(options);
+        opClient.execute(true);
+
+        MessageContext response = opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+        SOAPEnvelope env = response.getEnvelope();
+        assertNotNull(env);
         env.getBody().serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
                 System.out));
+        sender.finalizeInvoke();
     }
 
 

Modified: webservices/axis2/trunk/java/modules/samples/src/sample/amazon/search/AsynchronousClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/sample/amazon/search/AsynchronousClient.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/sample/amazon/search/AsynchronousClient.java
(original)
+++ webservices/axis2/trunk/java/modules/samples/src/sample/amazon/search/AsynchronousClient.java
Wed Jan  4 01:01:18 2006
@@ -19,8 +19,9 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.OutInAxisOperation;
@@ -136,7 +137,7 @@
      */
     public static void sendMsg() throws AxisFault {
         prevSearch = search;
-        Call call = new Call();
+        //Call call = new Call();
         URL url = null;
         try {
             url =
@@ -153,7 +154,6 @@
         }
 
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(
                 new EndpointReference(url.toString()));
         MessageContext requestContext = ClientUtil.getMessageContext();
@@ -167,10 +167,14 @@
             QName opName = new QName("urn:GoogleSearch", "doGoogleSearch");
             AxisOperation opdesc = new OutInAxisOperation();
             opdesc.setName(opName);
-            call.invokeNonBlocking(opdesc,
-                    requestContext,
-                    new ClientCallbackHandler());
 
+
+            ServiceClient serviceClient = new ServiceClient();
+            serviceClient.setOptions(options);
+            OperationClient opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+            opClient.addMessageContext(requestContext);
+            opClient.setCallback(new ClientCallbackHandler());
+            opClient.execute(false);
         } catch (AxisFault e1) {
             e1.printStackTrace();
         } catch (XMLStreamException e) {

Modified: webservices/axis2/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java
(original)
+++ webservices/axis2/trunk/java/modules/samples/src/sample/google/search/AsynchronousClient.java
Wed Jan  4 01:01:18 2006
@@ -19,8 +19,9 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.OutInAxisOperation;
@@ -82,7 +83,6 @@
     public synchronized void sendMsg() throws AxisFault {
         search.trim();
         prevSearch = search;
-        Call call = new Call();
         URL url = null;
         try {
             url = new URL("http", "api.google.com", "/search/beta2");
@@ -93,7 +93,6 @@
         }
 
         Options options = new Options();
-        call.setClientOptions(options);
         options.setTo(
                 new EndpointReference(url.toString()));
 
@@ -104,9 +103,12 @@
             AxisOperation opdesc = new OutInAxisOperation();
             opdesc.setName(opName);
             //   AxisOperation opdesc = new AxisOperation(new QName("viewVersion"));
-            call.invokeNonBlocking(opdesc,
-                    requestContext,
-                    new ClientCallbackHandler(this.gui));
+            ServiceClient serviceClient = new ServiceClient();
+            serviceClient.setOptions(options);
+            OperationClient opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+            opClient.addMessageContext(requestContext);
+            opClient.setCallback(new ClientCallbackHandler(this.gui));
+            opClient.execute(false);
 
         } catch (AxisFault e1) {
             e1.printStackTrace();

Modified: webservices/axis2/trunk/java/modules/samples/src/sample/sgccalculator/CalcClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/sample/sgccalculator/CalcClient.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/sample/sgccalculator/CalcClient.java
(original)
+++ webservices/axis2/trunk/java/modules/samples/src/sample/sgccalculator/CalcClient.java
Wed Jan  4 01:01:18 2006
@@ -18,14 +18,17 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
+import org.apache.axis2.client.OperationClient;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.FactoryConfigurationError;
@@ -48,10 +51,8 @@
 
         System.out.println("\nTHIS IS A SAMPLE APPLICATION TO DEMONSTRATE THE FUNCTIONALITY
OF SERVICE GROUPS");
         System.out.println("===============================================================================");
-        Call call = new Call();
         Options options = new Options();
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-        call.setClientOptions(options);
 
         boolean exit = false;
         String serviceGroupContextId = null;
@@ -101,8 +102,22 @@
                     opStr = "multiply";
                 }
                 System.out.println("Invoking...");
-                SOAPEnvelope result = call.invokeBlocking(opStr, getRequestEnvelope(opStr,
param1, param2,
+
+                ServiceClient serviceClient = new ServiceClient();
+                serviceClient.setOptions(options);
+                MessageContext requetMessageContext = new MessageContext();
+                requetMessageContext.setEnvelope(getRequestEnvelope(opStr, param1, param2,
                         serviceGroupContextId));
+
+                OperationClient opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+                opClient.addMessageContext(requetMessageContext);
+                opClient.setOptions(options);
+
+                opClient.execute(true);
+
+                SOAPEnvelope result = opClient.getMessageContext(
+                        WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();
+
                 printResult(result);
 
                 if (serviceGroupContextId == null)
@@ -128,8 +143,23 @@
                 }
 
                 System.out.println("Invoking...");
-                SOAPEnvelope result = call.invokeBlocking(opStr, getPreviousRequestEnvelope(opStr,
param,
+
+
+                ServiceClient serviceClient = new ServiceClient();
+                serviceClient.setOptions(options);
+                MessageContext requetMessageContext = new MessageContext();
+                requetMessageContext.setEnvelope(getPreviousRequestEnvelope(opStr, param,
                         serviceGroupContextId));
+
+                OperationClient opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
+                opClient.addMessageContext(requetMessageContext);
+                opClient.setOptions(options);
+
+                opClient.execute(true);
+
+                SOAPEnvelope result = opClient.getMessageContext(
+                        WSDLConstants.MESSAGE_LABEL_IN_VALUE).getEnvelope();
+
                 printResult(result);
 
             }

Modified: webservices/axis2/trunk/java/modules/samples/src/userguide/clients/ClientSideModuleEngagement.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/userguide/clients/ClientSideModuleEngagement.java?rev=365867&r1=365866&r2=365867&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/src/userguide/clients/ClientSideModuleEngagement.java
(original)
+++ webservices/axis2/trunk/java/modules/samples/src/userguide/clients/ClientSideModuleEngagement.java
Wed Jan  4 01:01:18 2006
@@ -1,4 +1,3 @@
-
 package userguide.clients;
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -15,7 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import org.apache.axis2.client.Call;
+
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
 
 import javax.xml.namespace.QName;
 import java.io.File;
@@ -23,23 +25,26 @@
 
 /**
  * Sample for engaged modules in Client side.
- * Logging module has been used. 
+ * Logging module has been used.
  */
 public class ClientSideModuleEngagement {
-    public static void main(String[] args) throws Exception{
+    public static void main(String[] args) throws Exception {
         String home = System.getProperty("user.home");
         // create this folder at your home. This folder could be anything
         //then create the "modules" folder
 
-        File repository = new File(home+File.separator+"client-repository");
+        File repository = new File(home + File.separator + "client-repository");
         if (!repository.exists()) {
             throw new FileNotFoundException("Repository Doesnot Exist");
         }
         //copy the LoggingModule.mar to "modules" folder.
         //then modify the axis2.xml that is generating there according to
         //phases that being included in the "module.xml"
-        Call call = new Call(repository.getAbsolutePath());
-        call.engageModule(new QName("LoggingModule"));
+        ConfigurationContext configContext = new ConfigurationContextFactory().
+                buildConfigurationContext(repository.getAbsolutePath());
+        ServiceClient serviceClient = new ServiceClient(configContext, null);
+        serviceClient.engageModule(new QName("LoggingModule"));
+//        call.engageModule(new QName("LoggingModule"));
     }
 }
 



Mime
View raw message