synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sami...@apache.org
Subject svn commit: r365825 - in /incubator/synapse/trunk/java/src: org/apache/synapse/ org/apache/synapse/axis2/ samples/userguide/ samples/userguide/log/
Date Wed, 04 Jan 2006 05:02:20 GMT
Author: saminda
Date: Tue Jan  3 21:02:06 2006
New Revision: 365825

URL: http://svn.apache.org/viewcvs?rev=365825&view=rev
Log:
1. Changed sample code to cope with current Axis2 status
2. Logic of Axis2FlexibleMEPClient changed. Now this logic can hanlde transport configuration
from main axis2.xml. 
Now routing of messages can be done with any transport. I will put a document on this. {JIRA-5
is partially fixed}

Modified:
    incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java
    incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
    incubator/synapse/trunk/java/src/samples/userguide/DumbStockQuoteClient.java
    incubator/synapse/trunk/java/src/samples/userguide/ProxyStockQuoteClient.java
    incubator/synapse/trunk/java/src/samples/userguide/StockQuoteClient.java
    incubator/synapse/trunk/java/src/samples/userguide/log/LoggingClient.java

Modified: incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java?rev=365825&r1=365824&r2=365825&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java (original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/Constants.java Tue Jan  3 21:02:06
2006
@@ -50,4 +50,9 @@
 
     String SECURITY_QOS = "synapse_security";
     String ADDRESSING_PROCESSED_CONFIGURATION_CONTEXT = "addressing_processed_configurationContext";
+
+    // Synapse's client side repository settng
+
+    String DIRECTORY_HOME_SYNAPSE_AS_CLIENT = ".synapse_as_client";
+    String HOME_USER = "user.home";
 }

Modified: incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java?rev=365825&r1=365824&r2=365825&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
(original)
+++ incubator/synapse/trunk/java/src/org/apache/synapse/axis2/Axis2FlexibleMEPClient.java
Tue Jan  3 21:02:06 2006
@@ -16,7 +16,6 @@
 
 package org.apache.synapse.axis2;
 
-import org.apache.axis2.addressing.EndpointReference;
 
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
@@ -24,15 +23,16 @@
 import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEngine;
 
 import org.apache.axis2.soap.SOAPEnvelope;
-import org.apache.axis2.transport.TransportUtils;
-import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
 import org.apache.axis2.util.UUIDGenerator;
+import org.apache.axis2.deployment.util.PhasesInfo;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
 
 import org.apache.synapse.Constants;
-import org.apache.synapse.SynapseException;
+import org.apache.wsdl.WSDLConstants;
 
 
 import javax.xml.namespace.QName;
@@ -43,147 +43,87 @@
  */
 public class Axis2FlexibleMEPClient {
 
-    // wholesale cut and paste from axis2.clientapi.*
-    public static MessageContext send(MessageContext smc) {
-        try {
-
-            // create a lightweight Axis Config with no addressing
-            AxisConfiguration ac = new AxisConfiguration();
-            ConfigurationContext cc = new ConfigurationContext(ac);
-            AxisServiceGroup asg = new AxisServiceGroup(ac);
-            AxisService as = new AxisService("__ANONYMOUS_SERVICE__");
-            asg.addService(as);
-            ServiceGroupContext sgc = new ServiceGroupContext(cc, asg);
-            ServiceContext sc = sgc.getServiceContext(as);
-            //todo: explicitly assumes __OPERATION_OUT_IN__
-            //todo: need a way to support others __OPERATION_OUT_ONLY__ , __OPERATION_ROBUST_OUT_ONLY__
-            AxisOperation axisOperationTemplateOutIn = new OutInAxisOperation(
-                    new QName("__OPERATION_OUT_IN__"));
-            as.addOperation(axisOperationTemplateOutIn);
-            cc.getAxisConfiguration().addService(as);
-            // todo: TransportOutDescription handles Http only. Need to integrate other
-            // todo: transports too.
-            TransportOutDescription tod = new TransportOutDescription(
-                    new QName(org.apache.axis2.Constants.TRANSPORT_HTTP));
-            tod.setSender(new CommonsHTTPTransportSender());
-
-            ac.addTransportOut(tod);
-
-            MessageContext msgCtx = new MessageContext(sc
-                    .getConfigurationContext());
-
-            if (smc.getSoapAction() != null)
-                msgCtx.setSoapAction(smc.getSoapAction());
-            if (smc.getTo() != null)
-                msgCtx.setTo(smc.getTo());
-            if (smc.getWSAAction() != null)
-                msgCtx.setWSAAction(smc.getWSAAction());
-            if (smc.getFrom() != null)
-                msgCtx.setFrom(smc.getFrom());
-            if (smc.getMessageID() != null)
-                msgCtx.setMessageID(smc.getMessageID());
-            else
-                msgCtx.setMessageID(String.valueOf("uuid:"
-                        + UUIDGenerator.getUUID()));
-            if (smc.getReplyTo() != null)
-                msgCtx.setReplyTo(smc.getReplyTo());
-            if (smc.getRelatesTo() != null)
-                msgCtx.setRelatesTo(smc.getRelatesTo());
-
-            /**
-             * We need to detach the body of the Env and attach only the body
-             * part that is necessary
-             */
-
-            msgCtx.setEnvelope(outEnvelopeConfiguration(smc));
-            msgCtx.setServiceContext(sc);
-
-            EndpointReference epr = msgCtx.getTo();
-            String transport = null;
-            if (epr != null) {
-                String toURL = epr.getAddress();
-                int index = toURL.indexOf(':');
-                if (index > 0) {
-                    transport = toURL.substring(0, index);
-                }
-            }
-
-            if (transport != null) {
-
-                msgCtx.setTransportOut(sc.getConfigurationContext()
-                        .getAxisConfiguration().getTransportOut(
-                        new QName(transport)));
-
-            } else {
-                throw new SynapseException("cannotInferTransport");
-            }
-            // initialize and set the Operation Context
-
-            msgCtx.setOperationContext(axisOperationTemplateOutIn
-                    .findOperationContext(msgCtx, sc));
-            AxisEngine engine = new AxisEngine(cc);
-
-            // engage addressing if desired
-            Boolean engageAddressing =
-                    (Boolean) smc.getProperty(Constants.ADD_ADDRESSING);
-            if (engageAddressing != null) {
-                if (engageAddressing.booleanValue()) ac.engageModule(new QName(
-                        org.apache.axis2.Constants.MODULE_ADDRESSING));
-            }
-
-            engine.send(msgCtx);
-            /**
-             * for the response to be handle from SynapseEnvironment, we need
-             * AxisConfiguration from the first dispatchiing
-             * so we should have first MessageContext properties
-             */
-
-            MessageContext response = new MessageContext(smc
-                    .getConfigurationContext(), smc.getSessionContext(),
-                    smc.getTransportIn(), smc.getTransportOut());
-
-
-            response.setProperty(MessageContext.TRANSPORT_IN, msgCtx
-                    .getProperty(MessageContext.TRANSPORT_IN));
-            msgCtx.getAxisOperation().registerOperationContext(response,
-                    msgCtx.getOperationContext());
-
-            response.setServerSide(false);
-            response.setServiceContext(smc.getServiceContext());
-            response.setServiceGroupContext(smc.getServiceGroupContext());
-            response.setProperty(MessageContext.TRANSPORT_OUT,
-                    smc.getProperty(MessageContext.TRANSPORT_OUT));
-            response.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
-                    smc.getProperty(
-                            org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
-
-            // If request is REST we assume the response is REST, so set the
-            // variable
-            response.setDoingREST(msgCtx.isDoingREST());
-
-            SOAPEnvelope resenvelope = TransportUtils.createSOAPMessage(
-                    response, msgCtx.getEnvelope().getNamespace().getName());
-
-
-            response.setEnvelope(resenvelope);
-            engine = new AxisEngine(msgCtx.getConfigurationContext());
-            engine.receive(response);
-            response.setProperty(Constants.ISRESPONSE_PROPERTY, new Boolean(
-                    true));
-            response.getOperationContext()
-                    .setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,
-                            org.apache.axis2.Constants.VALUE_TRUE);
-            return response;
-        } catch (Exception e) {
-            throw new SynapseException(e);
-        }
-
-    }
-
     private static SOAPEnvelope outEnvelopeConfiguration(MessageContext smc) {
         SOAPEnvelope env = smc.getEnvelope();
         env.getHeader().detach();
         return env;
     }
+    // Following code is based on Axis2 Client code. 
+    public static MessageContext send(MessageContext smc) throws AxisFault {
+        // In this logic Synapse Work as a Client to a Server
+        // So here this logic should expect 200 ok, 202 ok and 500 internal server error
+        // current state of the code in Synchronus
+
+        // This is the original_configuration_context
+        ConfigurationContext cc = smc.getConfigurationContext();
+        AxisConfiguration ac = cc.getAxisConfiguration();
+        PhasesInfo phasesInfo = ac.getPhasesInfo();
+        // Lets default be OUT_IN
+        OutInAxisOperation outInOperation = new OutInAxisOperation(new QName(
+                "__OPERATION_OUT_IN__"));
+        AxisService axisAnonymousService = new AxisService("ANONYMOUS_SERVICE");
+
+        // setting operation default chains
+        phasesInfo.setOperationPhases(outInOperation);
+        axisAnonymousService.addOperation(outInOperation);
+        ac.addService(axisAnonymousService);
+        ServiceGroupContext sgc =
+                new ServiceGroupContext(cc, axisAnonymousService.getParent());
+        ServiceContext sc = sgc.getServiceContext(axisAnonymousService);
+        //
+        MessageContext mc = new MessageContext(sc.getConfigurationContext());
+        ///////////////////////////////////////////////////////////////////////
+        // filtering properties
+        if (smc.getSoapAction() != null)
+            mc.setSoapAction(smc.getSoapAction());
+        if (smc.getWSAAction() != null)
+            mc.setWSAAction(smc.getWSAAction());
+        if (smc.getFrom() != null)
+            mc.setFrom(smc.getFrom());
+        if (smc.getMessageID() != null)
+            mc.setMessageID(smc.getMessageID());
+        else
+            mc.setMessageID(String.valueOf("uuid:"
+                    + UUIDGenerator.getUUID()));
+        if (smc.getReplyTo() != null)
+            mc.setReplyTo(smc.getReplyTo());
+        if (smc.getRelatesTo() != null)
+            mc.setRelatesTo(smc.getRelatesTo());
+        if (smc.getTo() != null) {
+            mc.setTo(smc.getTo());
+        } else {
+            throw new AxisFault(
+                    "To canno't be null, if null Synapse can't infer the transport");
+        }
+        mc.setEnvelope(outEnvelopeConfiguration(smc));
+        ///////////////////////////////////////////////////////////////////////
+
+
+        AxisOperation axisAnonymousOperation = axisAnonymousService
+                .getOperation(new QName("__OPERATION_OUT_IN__"));
+
+        //Options class from Axis2 holds client side settings
+        Options options = new Options();
+
+        OperationClient mepClient =
+                axisAnonymousOperation.createClient(sc, options);
+        mepClient.addMessageContext(mc);
+        mepClient.execute(false);
+        MessageContext response = mepClient
+                .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+        response.setProperty(MessageContext.TRANSPORT_OUT,
+                smc.getProperty(MessageContext.TRANSPORT_OUT));
+        response.setProperty(org.apache.axis2.Constants.OUT_TRANSPORT_INFO,
+                smc.getProperty(
+                        org.apache.axis2.Constants.OUT_TRANSPORT_INFO));
+
+        // If request is REST we assume the response is REST, so set the
+        // variable
+        response.setDoingREST(smc.isDoingREST());
+        response.setProperty(Constants.ISRESPONSE_PROPERTY, new Boolean(
+                    true));
+        return response;
+    }
+
 
 }

Modified: incubator/synapse/trunk/java/src/samples/userguide/DumbStockQuoteClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/samples/userguide/DumbStockQuoteClient.java?rev=365825&r1=365824&r2=365825&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/samples/userguide/DumbStockQuoteClient.java (original)
+++ incubator/synapse/trunk/java/src/samples/userguide/DumbStockQuoteClient.java Tue Jan 
3 21:02:06 2006
@@ -6,9 +6,9 @@
 
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
 
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.context.ServiceGroupContext;
@@ -96,14 +96,13 @@
 			tod.setSender(new CommonsHTTPTransportSender());
 			ac.addTransportOut(tod);
 
-			// make the call
-			Call call;
-			call = new Call(sc);
+			// make the ServiceClient
+			ServiceClient serviceClient = new ServiceClient();
 
-			call.setClientOptions(options);
+			serviceClient.setOptions(options);
 
 			// step 3 - Blocking invocation
-			OMElement result = call.invokeBlocking("getQuote", getQuote);
+			OMElement result = serviceClient.sendReceive(getQuote);
 
 			// step 4 - parse result
 			QName gQR = new QName("urn:xmethods-delayed-quotes",

Modified: incubator/synapse/trunk/java/src/samples/userguide/ProxyStockQuoteClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/samples/userguide/ProxyStockQuoteClient.java?rev=365825&r1=365824&r2=365825&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/samples/userguide/ProxyStockQuoteClient.java (original)
+++ incubator/synapse/trunk/java/src/samples/userguide/ProxyStockQuoteClient.java Tue Jan
 3 21:02:06 2006
@@ -6,9 +6,9 @@
 
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
 
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.context.ServiceGroupContext;
@@ -121,14 +121,13 @@
 			tod.setSender(new CommonsHTTPTransportSender());
 			ac.addTransportOut(tod);
 
-			// make the call
-			Call call;
-			call = new Call(sc);
+			// make the ServiceClient
+			ServiceClient serviceClient = new ServiceClient();
 
-			call.setClientOptions(options);
+			serviceClient.setOptions(options);
 
 			// step 3 - Blocking invocation
-			OMElement result = call.invokeBlocking("getQuote", getQuote);
+			OMElement result = serviceClient.sendReceive(getQuote);
 
 			// step 4 - parse result
 			QName gQR = new QName("urn:xmethods-delayed-quotes",

Modified: incubator/synapse/trunk/java/src/samples/userguide/StockQuoteClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/samples/userguide/StockQuoteClient.java?rev=365825&r1=365824&r2=365825&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/samples/userguide/StockQuoteClient.java (original)
+++ incubator/synapse/trunk/java/src/samples/userguide/StockQuoteClient.java Tue Jan  3 21:02:06
2006
@@ -4,8 +4,8 @@
 
 
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Call;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.MessageContextConstants;
 
 import org.apache.axis2.om.OMAbstractFactory;
@@ -13,93 +13,94 @@
 import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.om.OMText;
+import org.apache.axis2.Constants;
 
 public class StockQuoteClient {
 
-	/**
-	 * @param args
-	 *            <p>
-	 *            This is a fairly static test client for Synapse. It makes a
-	 *            StockQuote request to XMethods stockquote service. The EPR it
-	 *            is sent to is for XMethods, but the actual transport URL is
-	 *            designed to go to the Synapse listener.
-	 * 
-	 */
-	public static void main(String[] args) {
-
-		if (args.length > 0 && args[0].substring(0, 1).equals("-")) {
-			System.out
-					.println("Usage: StockQuoteClient Symbol XmethodsURL TransportURL");
-			System.out
-					.println("\nDefault values: IBM http://64.124.140.30:9090/soap http://localhost:8080");
-			System.out
-					.println("\nThe XMethods URL will be used in the <wsa:To> header");
-			System.out
-					.println("The Transport URL will be used as the actual address to send to");
-			System.out
-					.println("\nTo bypass Synapse, set the transport URL to the XMethods URL: \n"
-							+ "e.g. StockQuoteClient IBM http://64.124.140.30:9090/soap http://64.124.140.30:9090/soap\n"
-							+ "\nTo demonstrate Synapse virtual URLs, set the xmethods URL to urn:xmethods-delayed-quotes\n"
-							+ "\nTo demonstrate content-based behaviour, set the Symbol to MSFT\n"
-							+ "\nAll examples depend on using the sample synapse.xml");
-			System.exit(0);
-		}
-
-		String symb = "IBM";
-		String xurl = "http://64.124.140.30:9090/soap";
-		String turl = "http://localhost:8080";
-
-		if (args.length > 0)
-			symb = args[0];
-		if (args.length > 1)
-			xurl = args[1];
-		if (args.length > 2)
-			turl = args[2];
-
-		try {
-
-			// step 1 - create a request payload
-			OMFactory factory = OMAbstractFactory.getOMFactory(); // access to
-			// OM
-			OMNamespace xNs = factory.createOMNamespace(
-					"urn:xmethods-delayed-quotes", "x");
-			OMElement getQuote = factory.createOMElement("getQuote", xNs);
-			OMElement symbol = factory.createOMElement("symbol", xNs);
-			getQuote.addChild(symbol);
-			symbol.setText(symb);
-
-			// step 2 - set up the call object
-			
-			// the wsa:To
-			EndpointReference targetEPR = new EndpointReference(xurl);
-
-			Options options = new Options();
-			options.setTo(targetEPR);
-
-			// the transport URL
-			options.setProperty(MessageContextConstants.TRANSPORT_URL, turl);
-
-			Call call;
-			call = new Call();
-			call.setClientOptions(options);
-			
-			// step 3 - Blocking invocation
-			OMElement result = call.invokeBlocking("getQuote", getQuote);
-
-			// step 4 - parse result
-			QName gQR = new QName("urn:xmethods-delayed-quotes",
-					"getQuoteResponse");
-			QName Result = new QName("Result");
-			OMElement qResp = (OMElement) result.getChildrenWithName(gQR)
-					.next();
-			OMText res = (OMText) qResp.getChildrenWithName(Result).next();
-
-			System.out.println("Stock price = $" + res.getText());
-
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
+    /**
+     * @param args
+     *            <p>
+     *            This is a fairly static test client for Synapse. It makes a
+     *            StockQuote request to XMethods stockquote service. The EPR it
+     *            is sent to is for XMethods, but the actual transport URL is
+     *            designed to go to the Synapse listener.
+     *
+     */
+    public static void main(String[] args) {
+
+        if (args.length > 0 && args[0].substring(0, 1).equals("-")) {
+            System.out
+                    .println("Usage: StockQuoteClient Symbol XmethodsURL TransportURL");
+            System.out
+                    .println("\nDefault values: IBM http://64.124.140.30:9090/soap http://localhost:8080");
+            System.out
+                    .println("\nThe XMethods URL will be used in the <wsa:To> header");
+            System.out
+                    .println("The Transport URL will be used as the actual address to send
to");
+            System.out
+                    .println("\nTo bypass Synapse, set the transport URL to the XMethods
URL: \n"
+                            + "e.g. StockQuoteClient IBM http://64.124.140.30:9090/soap http://64.124.140.30:9090/soap\n"
+                            + "\nTo demonstrate Synapse virtual URLs, set the xmethods URL
to urn:xmethods-delayed-quotes\n"
+                            + "\nTo demonstrate content-based behaviour, set the Symbol to
MSFT\n"
+                            + "\nAll examples depend on using the sample synapse.xml");
+            System.exit(0);
+        }
+
+        String symb = "IBM";
+        String xurl = "http://64.124.140.30:9090/soap";
+        String turl = "http://64.124.140.30:9090/soap";
+
+        if (args.length > 0)
+            symb = args[0];
+        if (args.length > 1)
+            xurl = args[1];
+        if (args.length > 2)
+            turl = args[2];
+
+        try {
+
+            // step 1 - create a request payload
+            OMFactory factory = OMAbstractFactory.getOMFactory(); // access to
+            // OM
+            OMNamespace xNs = factory.createOMNamespace(
+                    "urn:xmethods-delayed-quotes", "x");
+            OMElement getQuote = factory.createOMElement("getQuote", xNs);
+            OMElement symbol = factory.createOMElement("symbol", xNs);
+            getQuote.addChild(symbol);
+            symbol.setText(symb);
+
+            // step 2 - set up the call object
+
+            // the wsa:To
+            EndpointReference targetEPR = new EndpointReference(xurl);
+
+            Options options = new Options();
+            options.setTo(targetEPR);
+            options.setProperty(MessageContextConstants.CHUNKED, Constants.VALUE_FALSE);
+
+            // the transport URL
+            options.setProperty(MessageContextConstants.TRANSPORT_URL, turl);
+
+            ServiceClient serviceClient = new ServiceClient();
+            serviceClient.setOptions(options);
+
+            // step 3 - Blocking invocation
+            OMElement result = serviceClient.sendReceive(getQuote);
+
+            // step 4 - parse result
+            QName gQR = new QName("urn:xmethods-delayed-quotes",
+                    "getQuoteResponse");
+            QName Result = new QName("Result");
+            OMElement qResp = (OMElement) result.getChildrenWithName(gQR)
+                    .next();
+            OMText res = (OMText) qResp.getChildrenWithName(Result).next();
+
+            System.out.println("Stock price = $" + res.getText());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
-	}
+    }
 
 }

Modified: incubator/synapse/trunk/java/src/samples/userguide/log/LoggingClient.java
URL: http://svn.apache.org/viewcvs/incubator/synapse/trunk/java/src/samples/userguide/log/LoggingClient.java?rev=365825&r1=365824&r2=365825&view=diff
==============================================================================
--- incubator/synapse/trunk/java/src/samples/userguide/log/LoggingClient.java (original)
+++ incubator/synapse/trunk/java/src/samples/userguide/log/LoggingClient.java Tue Jan  3 21:02:06
2006
@@ -18,27 +18,25 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.MessageSender;
 import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMFactory;
 import org.apache.axis2.om.OMNamespace;
 
-import javax.xml.namespace.QName;
 
 public class LoggingClient {
     private static EndpointReference targetEpr = new EndpointReference(
             "http://127.0.0.1:8080/synapse/services/mock_service");
-    private static QName operation = new QName("mock_operation");
 
     public static void main(String[] args) {
         try {
-            MessageSender msgSender = new MessageSender();
+            ServiceClient serviceClient = new ServiceClient();
             Options co = new Options();
             co.setTo(targetEpr);
-            msgSender.setClientOptions(co);
-            msgSender.send(operation.getLocalPart(), payload());
+            serviceClient.setOptions(co);
+            serviceClient.fireAndForget(payload());
         } catch (AxisFault axisFault) {
             axisFault
                     .printStackTrace();



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message