Hi,
I generated my asynchronous Axis2 client and service using WSDL2Java Ant
task(i.e., I set asynconly to true when calling the ant task). When I sent a
request to the service using the client, the client always exited
successfully. However, the server never received any request, and the
client's callback method never got called. The strange thing is, if I
stepped through the client in a debugger slowly, the server would receive
the request, but failed to return the response because the client had
already terminated.

Here is how I called the client, and it always exited successfully:

MyServiceStub stub = new MyServiceStub("
http://localhost:8080/axis2/services/myservice";);
GetResultsRequest request = new GetResultsRequest();

//Set a number of request parameters here

stub.startGetResults(request, new MyServiceCallbackHandler(){
public void receiveResultGetResults(GetResultsResponse result) {
System.out.println(result.getMessage());
}
});

I turned on logging of axis2, and found if the server didn't receive any
request, the client-side log would end with the following traces:

(ConfigurationContext.java:329) 2009-03-11 22:19:00,350 DEBUG
registerOperationContext (false):
org.apache.axis2.context.operationcont...@10f0625 with key:
urn:uuid:4CA907BDD68BB1F7B81236835140359
(OutInAxisOperation.java:167) 2009-03-11 22:19:16,610 DEBUG Entry:
OutInAxisOperationClient::execute, false
(OutInAxisOperation.java:197) 2009-03-11 22:19:23,781 DEBUG
OutInAxisOperationClient: useAsyncOption null
(ConfigurationContext.java:329) 2009-03-11 22:21:13,352 DEBUG
registerOperationContext (false):
org.apache.axis2.context.operationcont...@10f0625 with key:
urn:uuid:4CA907BDD68BB1F7B81236835140359
(ConfigurationContext.java:336) 2009-03-11 22:21:13,352 DEBUG msgContext:
[MessageContext: logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] action:
http://myservice.services.my.com/GetResults
(Phase.java:292) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "OperationOutPhase"
(Phase.java:305) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase
"OperationOutPhase"
(Phase.java:328) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "OperationOutPhase"
(Phase.java:292) 2009-03-11 22:21:13,355 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "RMPhase"
(Phase.java:305) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "RMPhase"
(Phase.java:328) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "RMPhase"
(Phase.java:292) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "PolicyDetermination"
(Phase.java:305) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase
"PolicyDetermination"
(Phase.java:328) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "PolicyDetermination"
(Phase.java:292) 2009-03-11 22:21:13,356 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "MessageOut"
(Phase.java:305) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "MessageOut"
(Phase.java:328) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "MessageOut"
(Phase.java:292) 2009-03-11 22:21:13,357 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking pre-condition for
Phase "Security"
(Phase.java:305) 2009-03-11 22:21:13,359 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Invoking phase "Security"
(Phase.java:328) 2009-03-11 22:21:13,359 DEBUG [MessageContext:
logID=urn:uuid:4CA907BDD68BB1F7B81236835273363] Checking post-conditions for
phase "Security"

If the server did get the request from the client, the client-side log would
end with the following trace in addition to the traces mentioned above:

(SOAPMessageFormatter.java:133) 2009-03-11 22:21:13,433 DEBUG contentType
from the OMOutputFormat =text/xml
(SOAPMessageFormatter.java:158) 2009-03-11 22:21:13,434 DEBUG contentType
returned =text/xml; charset=UTF-8
(AbstractContext.java:407) 2009-03-11 22:21:13,441 DEBUG ==================
(AbstractContext.java:408) 2009-03-11 22:21:13,441 DEBUG  Property set on
object org.apache.axis2.context.messagecont...@3cbb4b
(AbstractContext.java:409) 2009-03-11 22:21:13,441 DEBUG   Key
=HTTP_METHOD_OBJECT
(AbstractContext.java:413) 2009-03-11 22:21:13,441 DEBUG   Value Class =
org.apache.commons.httpclient.methods.PostMethod
(AbstractContext.java:414) 2009-03-11 22:21:13,441 DEBUG   Value Classloader
= sun.misc.launcher$appclassloa...@1a7bf11
(AbstractContext.java:416) 2009-03-11 22:21:13,442 DEBUG Call Stack =
DEBUG_FRAME =
org.apache.axis2.util.JavaUtils.callStackToString(JavaUtils.java:564)
DEBUG_FRAME =
org.apache.axis2.context.AbstractContext.debugPropertySet(AbstractContext.java:416)
DEBUG_FRAME =
org.apache.axis2.context.AbstractContext.setProperty(AbstractContext.java:182)
DEBUG_FRAME =
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:522)
DEBUG_FRAME =
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:189)
DEBUG_FRAME =
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
DEBUG_FRAME =
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessage
.....
.....

It seems somehow the client exited prematurely before the worker thread that
sent out request could finish.

Could anyone please let me know why this happened? Did I miss anything when
using asynchronous services? Is there any way I can fix this problem? Thanks
a lot!

Regards,

Yong

Reply via email to