You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by he...@apache.org on 2005/05/20 04:11:30 UTC
svn commit: r171034 - in /webservices/axis/trunk/java/modules:
addressing/src/META-INF/ core/src/org/apache/axis/clientapi/
core/src/org/apache/axis/context/ core/src/org/apache/axis/transport/http/
samples/ samples/test/org/apache/axis/engine/
Author: hemapani
Date: Thu May 19 19:11:29 2005
New Revision: 171034
URL: http://svn.apache.org/viewcvs?rev=171034&view=rev
Log:
get the complete async test case up
Added:
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java
Modified:
webservices/axis/trunk/java/modules/addressing/src/META-INF/module.xml
webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/ListenerManager.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java
webservices/axis/trunk/java/modules/samples/project.xml
Modified: webservices/axis/trunk/java/modules/addressing/src/META-INF/module.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/addressing/src/META-INF/module.xml?rev=171034&r1=171033&r2=171034&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/addressing/src/META-INF/module.xml (original)
+++ webservices/axis/trunk/java/modules/addressing/src/META-INF/module.xml Thu May 19 19:11:29 2005
@@ -7,7 +7,7 @@
<outflow>
<handler name="AddressingOutHandler" class="org.apache.axis.handlers.addressing.AddressingOutHandler">
- <order phase="addressing"/>
+ <order phase="MessageOut"/>
</handler>
</outflow>
</module>
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java?rev=171034&r1=171033&r2=171034&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java Thu May 19 19:11:29 2005
@@ -68,11 +68,6 @@
//variables use for internal implementations
/**
- * The Listener Manager is tempory hack to make it work till will Generalize the Transport Layer More.
- */
- protected ListenerManager listenerManager;
-
- /**
* This is used for the Receiving the Async Messages
*/
protected CallbackReceiver callbackReceiver;
@@ -207,8 +202,6 @@
}
- msgctx.setOperationContext(axisop.findOperationContext(msgctx, serviceContext, false));
- msgctx.setServiceContext(serviceContext);
if (useSeparateListener) {
String messageID = String.valueOf(System.currentTimeMillis());
@@ -216,13 +209,14 @@
axisop.setMessageReciever(callbackReceiver);
callbackReceiver.addCallback(messageID, callback);
msgctx.setReplyTo(
- listenerManager.replyToEPR(
+ ListenerManager.replyToEPR(
serviceContext.getServiceConfig().getName().getLocalPart()
+ "/"
+ axisop.getName().getLocalPart(),listenerTransport));
}
-
+ msgctx.setOperationContext(axisop.findOperationContext(msgctx, serviceContext, false));
+ msgctx.setServiceContext(serviceContext);
engine.send(msgctx);
//TODO start the server
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/ListenerManager.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/ListenerManager.java?rev=171034&r1=171033&r2=171034&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/ListenerManager.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/ListenerManager.java Thu May 19 19:11:29 2005
@@ -44,6 +44,7 @@
ListenerManager.configurationContext = configurationContext;
if (Constants.TRANSPORT_HTTP.equals(transport) && httpListener == null) {
httpListener = new SimpleHTTPServer(configurationContext, new ServerSocket(6060));
+ httpListener.start();
} else if (Constants.TRANSPORT_JMS.equals(transport) && jmsListener == null) {
throw new UnsupportedOperationException();
} else if (Constants.TRANSPORT_MAIL.equals(transport) && mailListener == null) {
@@ -56,15 +57,15 @@
}
}
- public EndpointReference replyToEPR(String serviceName, String transport) throws AxisFault {
+ public static EndpointReference replyToEPR(String serviceName, String transport) throws AxisFault {
ListenerManager.configurationContext = configurationContext;
- if (Constants.TRANSPORT_HTTP.equals(transport) && httpListener == null) {
+ if (Constants.TRANSPORT_HTTP.equals(transport) && httpListener != null) {
return httpListener.replyToEPR(serviceName);
- } else if (Constants.TRANSPORT_JMS.equals(transport) && jmsListener == null) {
+ } else if (Constants.TRANSPORT_JMS.equals(transport) && jmsListener != null) {
return jmsListener.replyToEPR(serviceName);
- } else if (Constants.TRANSPORT_MAIL.equals(transport) && mailListener == null) {
+ } else if (Constants.TRANSPORT_MAIL.equals(transport) && mailListener != null) {
return mailListener.replyToEPR(serviceName);
- } else if (Constants.TRANSPORT_TCP.equals(transport) && tcpListener == null) {
+ } else if (Constants.TRANSPORT_TCP.equals(transport) && tcpListener != null) {
return tcpListener.replyToEPR(serviceName);
}
throw new AxisFault(
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java?rev=171034&r1=171033&r2=171034&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java Thu May 19 19:11:29 2005
@@ -51,6 +51,10 @@
+ " And the Axis Operations suppiled supports "
+ axisop.getMessageExchangePattern());
}
+
+ if(serviceContext.getServiceConfig().getOperation(axisop.getName()) == null){
+ serviceContext.getServiceConfig().addOperation(axisop);
+ }
}
protected MessageContext prepareTheSystem(OMElement toSend) throws AxisFault {
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java?rev=171034&r1=171033&r2=171034&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/context/MessageContext.java Thu May 19 19:11:29 2005
@@ -21,7 +21,6 @@
import org.apache.axis.description.TransportInDescription;
import org.apache.axis.description.TransportOutDescription;
import org.apache.axis.engine.AxisFault;
-import org.apache.axis.engine.ExecutionChain;
import org.apache.axis.soap.SOAPEnvelope;
/**
@@ -60,8 +59,7 @@
private MessageInformationHeadersCollection messageInformationHeaders;
- private final ExecutionChain chain;
-
+
private OperationContext operationContext;
private ServiceContext serviceContext;
private ConfigurationContext engineContext;
@@ -116,6 +114,24 @@
private String serviceInstanceID;
/**
+ * @param engineContext
+ * @param sessionContext
+ * @param transportIn
+ * @param transportOut
+ * @param mepContext
+ * @throws AxisFault
+ */
+ public MessageContext(
+ ConfigurationContext engineContext,
+ MessageInformationHeadersCollection addressingHeaders)
+ throws AxisFault {
+ super(null);
+ this.messageInformationHeaders = addressingHeaders;
+ this.engineContext = engineContext;
+ sessionContext = null;
+ }
+
+ /**
* @param engineContext
* @param sessionContext
* @param transportIn
@@ -123,12 +139,13 @@
* @param mepContext
* @throws AxisFault
*/
- public MessageContext(ConfigurationContext engineContext,
- SessionContext sessionContext,
- TransportInDescription transportIn,
- TransportOutDescription transportOut,
- OperationContext mepContext)
- throws AxisFault {
+ public MessageContext(
+ ConfigurationContext engineContext,
+ SessionContext sessionContext,
+ TransportInDescription transportIn,
+ TransportOutDescription transportOut,
+ OperationContext mepContext)
+ throws AxisFault {
this(sessionContext, transportIn, transportOut, engineContext);
this.operationContext = mepContext;
@@ -142,11 +159,12 @@
* @throws AxisFault
*/
- public MessageContext(SessionContext sessionContext,
- TransportInDescription transportIn,
- TransportOutDescription transportOut,
- ConfigurationContext engineContext)
- throws AxisFault {
+ public MessageContext(
+ SessionContext sessionContext,
+ TransportInDescription transportIn,
+ TransportOutDescription transportOut,
+ ConfigurationContext engineContext)
+ throws AxisFault {
super(null);
if (sessionContext == null) {
@@ -154,7 +172,6 @@
} else {
this.sessionContext = sessionContext;
}
- chain = new ExecutionChain();
messageInformationHeaders = new MessageInformationHeadersCollection();
this.transportIn = transportIn;
this.transportOut = transportOut;
@@ -342,9 +359,7 @@
*
* @return
*/
- public ExecutionChain getExecutionChain() {
- return this.chain;
- }
+
public void setWSAAction(String actionURI) {
messageInformationHeaders.setAction(actionURI);
@@ -366,10 +381,6 @@
return messageInformationHeaders;
}
- public void setMessageInformationHeaders(MessageInformationHeadersCollection messageInformationHeaders) {
- this.messageInformationHeaders = messageInformationHeaders;
- }
-
/**
* @return
*/
@@ -477,6 +488,13 @@
*/
public void setServiceContext(ServiceContext context) {
serviceContext = context;
+ }
+
+ /**
+ * @param collection
+ */
+ public void setMessageInformationHeaders(MessageInformationHeadersCollection collection) {
+ messageInformationHeaders = collection;
}
}
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java?rev=171034&r1=171033&r2=171034&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/HTTPTransportReceiver.java Thu May 19 19:11:29 2005
@@ -15,6 +15,14 @@
*/
package org.apache.axis.transport.http;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
import org.apache.axis.addressing.AddressingConstants;
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.ConfigurationContext;
@@ -24,14 +32,6 @@
import org.apache.axis.om.impl.llom.builder.StAXBuilder;
import org.apache.axis.soap.SOAPEnvelope;
import org.apache.axis.soap.impl.llom.builder.StAXSOAPModelBuilder;
-import org.apache.axis.transport.TransportReceiver;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Map;
/**
* Class HTTPTransportReceiver
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java?rev=171034&r1=171033&r2=171034&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/transport/http/SimpleHTTPServer.java Thu May 19 19:11:29 2005
@@ -282,7 +282,7 @@
public EndpointReference replyToEPR(String serviceName) {
return new EndpointReference(
AddressingConstants.WSA_REPLY_TO,
- "http://127.0.0.1:" + (serverSocket.getLocalPort() + 1) + "/axis/services/" + serviceName);
+ "http://127.0.0.1:" + (serverSocket.getLocalPort()) + "/axis/services/" + serviceName);
}
}
Modified: webservices/axis/trunk/java/modules/samples/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/project.xml?rev=171034&r1=171033&r2=171034&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/project.xml (original)
+++ webservices/axis/trunk/java/modules/samples/project.xml Thu May 19 19:11:29 2005
@@ -107,11 +107,6 @@
<exclude>**/*Abstract*.java</exclude>
<exclude>**/*Util*.java</exclude>
<exclude>**/*InteropStubTest.java</exclude>
- <!-- <exclude>**/*EchoTest.java</exclude> -->
- <!-- <exclude>**/*TransportDeploymentTest.java</exclude> -->
- <!-- <exclude>**/*BuildERWithDeploymentTest.java</exclude>
- <exclude>**/*EchoRawXMLTest.java</exclude>
- <exclude>**/*HandlerFailureTest.java</exclude> -->
</excludes>
<includes>
<include>**/*Test.java</include>
Added: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java?rev=171034&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java (added)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLOnTwoChannelsTest.java Thu May 19 19:11:29 2005
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.engine;
+
+
+
+import java.io.File;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.TestCase;
+
+import org.apache.axis.Constants;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.clientapi.AsyncResult;
+import org.apache.axis.clientapi.Callback;
+import org.apache.axis.context.ConfigurationContext;
+import org.apache.axis.context.EngineContextFactory;
+import org.apache.axis.context.MessageContext;
+import org.apache.axis.context.ServiceContext;
+import org.apache.axis.deployment.DeploymentEngine;
+import org.apache.axis.description.ModuleDescription;
+import org.apache.axis.description.ServiceDescription;
+import org.apache.axis.integration.UtilServer;
+import org.apache.axis.om.OMAbstractFactory;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.phaseresolver.PhaseResolver;
+import org.apache.axis.soap.SOAPEnvelope;
+import org.apache.axis.soap.SOAPFactory;
+import org.apache.axis.transport.http.SimpleHTTPServer;
+import org.apache.axis.util.Utils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class EchoRawXMLOnTwoChannelsTest extends TestCase {
+ private EndpointReference targetEPR =
+ new EndpointReference(
+ AddressingConstants.WSA_TO,
+ "http://127.0.0.1:"
+ + (UtilServer.TESTING_PORT)
+ + "/axis/services/EchoXMLService/echoOMElement");
+ private Log log = LogFactory.getLog(getClass());
+ private QName serviceName = new QName("EchoXMLService");
+ private QName operationName = new QName("echoOMElement");
+ private QName transportName = new QName("http://localhost/my", "NullTransport");
+
+ private AxisConfiguration engineRegistry;
+ private MessageContext mc;
+ private Thread thisThread;
+ private SimpleHTTPServer sas;
+ private ServiceContext serviceContext;
+
+ private boolean finish = false;
+
+ public EchoRawXMLOnTwoChannelsTest() {
+ super(EchoRawXMLOnTwoChannelsTest.class.getName());
+ }
+
+ public EchoRawXMLOnTwoChannelsTest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ UtilServer.start();
+ UtilServer.getConfigurationContext().getEngineConfig().engageModule(new QName("addressing"));
+
+ ServiceDescription service =
+ Utils.createSimpleService(
+ serviceName,
+ org.apache.axis.engine.Echo.class.getName(),
+ operationName);
+ UtilServer.deployService(service);
+ serviceContext =
+ UtilServer.getConfigurationContext().createServiceContext(service.getName());
+
+ }
+
+ protected void tearDown() throws Exception {
+ UtilServer.unDeployService(serviceName);
+ UtilServer.stop();
+ }
+
+ private SOAPEnvelope createEnvelope(SOAPFactory fac) {
+ SOAPEnvelope reqEnv = fac.getDefaultEnvelope();
+ OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
+ OMElement method = fac.createOMElement("echoOMElement", omNs);
+ OMElement value = fac.createOMElement("myValue", omNs);
+ value.addChild(fac.createText(value, "Isaac Assimov, the foundation Sega"));
+ method.addChild(value);
+ reqEnv.getBody().addChild(method);
+ return reqEnv;
+ }
+
+
+ public void testEchoXMLCompleteASync() throws Exception {
+ DeploymentEngine deploymentEngine = new DeploymentEngine();
+ File file = new File("target/test-resources/repository-client/modules/addressing.mar");
+ //File file = new File("modules/samples/target/test-resources/repository-client/modules/addressing.mar");
+
+ assertTrue(file.exists());
+ ModuleDescription moduleDesc =
+ deploymentEngine.buildModule(file);
+
+ EngineContextFactory efac = new EngineContextFactory();
+ ConfigurationContext sysContext = efac.buildClientEngineContext(null);
+ new ConfigurationContext(new AxisSystemImpl());
+ sysContext.getEngineConfig().addMdoule(moduleDesc);
+ sysContext.getEngineConfig().engageModule(moduleDesc.getName());
+ ServiceDescription service =
+ Utils.createSimpleService(
+ serviceName,
+ org.apache.axis.engine.Echo.class.getName(),
+ operationName);
+ sysContext.getEngineConfig().addService(service);
+ Utils.resolvePhases(sysContext.getEngineConfig(),service);
+ ServiceContext serviceContext = sysContext.createServiceContext(service.getName());
+
+
+
+
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+
+
+ OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
+ OMElement method = fac.createOMElement("echoOMElement", omNs);
+ OMElement value = fac.createOMElement("myValue", omNs);
+ value.setText("Isaac Assimov, the foundation Sega");
+ method.addChild(value);
+
+
+ org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call(serviceContext);
+
+ call.setTo(targetEPR);
+ call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, true);
+ Callback callback = new Callback() {
+ public void onComplete(AsyncResult result) {
+ try {
+ result.getResponseEnvelope().serialize(
+ XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
+ } catch (XMLStreamException e) {
+ reportError(e);
+ } finally {
+ finish = true;
+ }
+ }
+
+ public void reportError(Exception e) {
+ e.printStackTrace();
+ finish = true;
+ }
+ };
+
+ call.invokeNonBlocking(operationName.getLocalPart(), method, callback);
+ while (!finish) {
+ Thread.sleep(1000);
+ }
+
+ log.info("send the reqest");
+
+}
+
+}