You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2006/04/20 15:55:09 UTC

svn commit: r395591 - /webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java

Author: dims
Date: Thu Apr 20 06:55:07 2006
New Revision: 395591

URL: http://svn.apache.org/viewcvs?rev=395591&view=rev
Log:
get JMSEchoRawXMLTest#testEchoXMLSyncMC working

Modified:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java?rev=395591&r1=395590&r2=395591&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java Thu Apr 20 06:55:07 2006
@@ -22,15 +22,20 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.OperationClient;
 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.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.OutInAxisOperation;
@@ -183,7 +188,8 @@
     }
 
     public void testEchoXMLSyncMC() throws Exception {
-        ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_REPOSITORY,null);
+        ConfigurationContext configContext =
+                ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_REPOSITORY, Constants.TESTING_REPOSITORY + "/conf/axis2.xml");
 
         AxisOperation opdesc = new OutInAxisOperation(new QName("echoOMElement"));
         Options options = new Options();
@@ -198,32 +204,34 @@
         OMElement value = fac.createOMElement("myValue", omNs);
         value.setText("Isaac Asimov, The Foundation Trilogy");
         method.addChild(value);
-//        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
-//        SOAPEnvelope envelope = factory.getDefaultEnvelope();
-//        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.setAxisOperation(opdesc);
+        SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope envelope = factory.getDefaultEnvelope();
+        envelope.getBody().addChild(method);
+
+        MessageContext requestContext = new MessageContext();
+        requestContext.setConfigurationContext(configContext);
+        requestContext.setAxisService(clientService);
+        requestContext.setAxisOperation(opdesc);
+        requestContext.setEnvelope(envelope);
 
-//        requestContext.setEnvelope(envelope);
-        //  call.invokeBlocking(opdesc, requestContext);
+        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();
+    }
+}
 
-//        SOAPEnvelope env = call.invokeBlocking("echoOMElement", envelope);
 
-        AxisConfiguration axisConfig = configContext.getAxisConfiguration();
-        axisConfig.addService(srevice);
 
-        ServiceClient sender = new ServiceClient(configContext, clientService);
-        sender.setOptions(options);
 
-        OMElement result = sender.sendReceive(operationName, method);
 
 
-        result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(
-                System.out));
-    }
-}