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 he...@apache.org on 2005/05/24 17:28:53 UTC
svn commit: r178189 - in /webservices/axis/trunk/java/modules:
core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
core/src/org/apache/axis/clientapi/InOutMEPClient.java
samples/test/org/apache/axis/integration/UtilServer.java
Author: hemapani
Date: Tue May 24 08:28:52 2005
New Revision: 178189
URL: http://svn.apache.org/viewcvs?rev=178189&view=rev
Log:
improve the Client API
Modified:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOutMEPClient.java
webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java?rev=178189&r1=178188&r2=178189&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/InOnlyMEPClient.java Tue May 24 08:28:52 2005
@@ -135,5 +135,9 @@
public void setTo(EndpointReference to) {
messageInformationHeaders.setTo(to);
}
+
+ public void engageModule(QName name) throws AxisFault{
+ serviceContext.getEngineContext().getEngineConfig().engageModule(name);
+ }
}
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=178189&r1=178188&r2=178189&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 Tue May 24 08:28:52 2005
@@ -116,31 +116,64 @@
final MessageContext msgctx)
throws AxisFault {
verifyInvocation(axisop);
+ if (useSeparateListener) {
+ SyncCallBack callback = new SyncCallBack();
+ invokeNonBlocking(axisop, msgctx, callback);
+ int index = 0;
+ while (!callback.hasResult()) {
+ if (index < 20) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ throw new AxisFault(e);
+ }
+ } else {
+ throw new AxisFault("Time out waiting for the response");
+ }
+ }
+ if (callback.envelope != null) {
+ MessageContext resMsgctx =
+ new MessageContext(
+ serviceContext.getEngineContext(),
+ null,
+ null,
+ null,
+ null);
+ resMsgctx.setEnvelope(callback.envelope);
+ return resMsgctx;
+ } else {
+ if (callback.error instanceof AxisFault) {
+ throw (AxisFault) callback.error;
+ } else {
+ throw new AxisFault(callback.error);
+ }
+ }
+ } else {
+ msgctx.setTo(to);
+ msgctx.setServiceContext(serviceContext);
+ ConfigurationContext syscontext = serviceContext.getEngineContext();
- msgctx.setTo(to);
- msgctx.setServiceContext(serviceContext);
- ConfigurationContext syscontext = serviceContext.getEngineContext();
-
- checkTransport(msgctx);
+ checkTransport(msgctx);
- ConfigurationContext sysContext = serviceContext.getEngineContext();
- AxisConfiguration registry = sysContext.getEngineConfig();
+ ConfigurationContext sysContext = serviceContext.getEngineContext();
+ AxisConfiguration registry = sysContext.getEngineConfig();
- msgctx.setOperationContext(
- OperationContextFactory.createMEPContext(
- WSDLConstants.MEP_CONSTANT_IN_OUT,
- false,
- axisop,
- serviceContext));
- MessageContext response =
- TwoChannelBasedSender.send(msgctx, listenerTransport);
-
- SOAPEnvelope resenvelope = response.getEnvelope();
- if (resenvelope.getBody().hasFault()) {
- throw new AxisFault(
- resenvelope.getBody().getFault().getException());
+ msgctx.setOperationContext(
+ OperationContextFactory.createMEPContext(
+ WSDLConstants.MEP_CONSTANT_IN_OUT,
+ false,
+ axisop,
+ serviceContext));
+ MessageContext response =
+ TwoChannelBasedSender.send(msgctx, listenerTransport);
+
+ SOAPEnvelope resenvelope = response.getEnvelope();
+ if (resenvelope.getBody().hasFault()) {
+ throw new AxisFault(
+ resenvelope.getBody().getFault().getException());
+ }
+ return response;
}
- return response;
}
public void invokeNonBlocking(
@@ -379,6 +412,20 @@
}
+ }
+
+ public class SyncCallBack extends Callback {
+ private SOAPEnvelope envelope;
+ private Exception error;
+ public void onComplete(AsyncResult result) {
+ this.envelope = result.getResponseEnvelope();
+ }
+ public void reportError(Exception e) {
+ error = e;
+ }
+ public boolean hasResult() {
+ return envelope != null || error != null;
+ }
}
}
Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java?rev=178189&r1=178188&r2=178189&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/integration/UtilServer.java Tue May 24 08:28:52 2005
@@ -39,8 +39,8 @@
private static SimpleHTTPServer reciver;
public static final int TESTING_PORT = 5555;
public static final String FAILURE_MESSAGE = "Intentional Faliure";
- public static final String TESTING_REPOSITORY = "target/test-resources/samples";
- //public static final String TESTING_REPOSITORY = "modules/samples/target/test-resources/samples";
+ //public static final String TESTING_REPOSITORY = "target/test-resources/samples";
+ public static final String TESTING_REPOSITORY = "modules/samples/target/test-resources/samples";
public static synchronized void deployService(ServiceDescription service) throws AxisFault {
reciver.getSystemContext().getEngineConfig().addService(service);