Ashish Soni
2015-04-28 13:56:12 UTC
Hi,
I am trying to implement the example mentioned in Apache Axis2 Advanced
Userâs Guide [http://axis.apache.org/axis2/java/core/docs/adv-userguide.html].
When writing the web service client using âDo a Non-Blocking Invocationâ I
found that:
1) itâs not terminating the client
2) Next execution of client itâs not calling the
Axis2SampleDocLitServiceCallbackHandler
3) both client hang.
4) All for further execution of client hang without entering to
Axis2SampleDocLitServiceCallbackHandler.
I found that itâs happening because it use a separate Listener for response
and after first execution of client itâs not getting cleaned up, so further
call to client hang and not entering to
Axis2SampleDocLitServiceCallbackHandler.
Code Snippet:
package org.apache.axis2.userguide;
import java.rmi.RemoteException;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.userguide.xsd.EchoStringParamDocument;
import org.apache.axis2.userguide.xsd.EchoStringReturnDocument;
public class Axis2SampleDocLitServiceClient {
public static void main(String[] args) {
Axis2SampleDocLitServiceStub stub= null;
try{
stub= new
Axis2SampleDocLitServiceStub("
http://localhost:9090/axis2/services/Axis2SampleDocLitService");
EchoStringParamDocument
reqDoc= EchoStringParamDocument.Factory.newInstance();
reqDoc.setEchoStringParam("Ashish Soni");
/**
* Do a Non-Blocking
Invocation
*/
*stub._getServiceClient().engageModule("addressing");*
*
stub._getServiceClient().getOptions().setUseSeparateListener(true);*
*
stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,
Constants.VALUE_TRUE);*
*
stub._getServiceClient().getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
Constants.VALUE_FALSE);*
Axis2SampleDocLitServiceCallbackHandler handler= new
Axis2SampleDocLitServiceCallbackHandler()
{
@Override
public void
receiveErrorechoString(Exception e) {
System.out.println(e.getMessage());
}
@Override
public void
receiveResultechoString(
EchoStringReturnDocument result) {
System.out.println("Callback Handler called: " +
result.getEchoStringReturn());
completed= true;
}
};
stub.startechoString(reqDoc, handler);
stub._getServiceClient().getOptions().getTransportIn().getReceiver().destroy();
}catch(RemoteException fault) {
fault.printStackTrace();
} finally {
if(stub!=null) {
try{
*stub._getServiceClient().cleanupTransport();
*
}catch(AxisFault fault) {
// Nothing need to be done
}
}
}
}
}
Could please help how to do the clean of *âresponse streamâ *after getting
the reponse.
References followed:
http://axis.apache.org/axis2/java/core/docs/adv-userguide.html
http://amilachinthaka.blogspot.in/2010/01/improving-axis2-http-transport-client.html
I am trying to implement the example mentioned in Apache Axis2 Advanced
Userâs Guide [http://axis.apache.org/axis2/java/core/docs/adv-userguide.html].
When writing the web service client using âDo a Non-Blocking Invocationâ I
found that:
1) itâs not terminating the client
2) Next execution of client itâs not calling the
Axis2SampleDocLitServiceCallbackHandler
3) both client hang.
4) All for further execution of client hang without entering to
Axis2SampleDocLitServiceCallbackHandler.
I found that itâs happening because it use a separate Listener for response
and after first execution of client itâs not getting cleaned up, so further
call to client hang and not entering to
Axis2SampleDocLitServiceCallbackHandler.
Code Snippet:
package org.apache.axis2.userguide;
import java.rmi.RemoteException;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.userguide.xsd.EchoStringParamDocument;
import org.apache.axis2.userguide.xsd.EchoStringReturnDocument;
public class Axis2SampleDocLitServiceClient {
public static void main(String[] args) {
Axis2SampleDocLitServiceStub stub= null;
try{
stub= new
Axis2SampleDocLitServiceStub("
http://localhost:9090/axis2/services/Axis2SampleDocLitService");
EchoStringParamDocument
reqDoc= EchoStringParamDocument.Factory.newInstance();
reqDoc.setEchoStringParam("Ashish Soni");
/**
* Do a Non-Blocking
Invocation
*/
*stub._getServiceClient().engageModule("addressing");*
*
stub._getServiceClient().getOptions().setUseSeparateListener(true);*
*
stub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,
Constants.VALUE_TRUE);*
*
stub._getServiceClient().getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
Constants.VALUE_FALSE);*
Axis2SampleDocLitServiceCallbackHandler handler= new
Axis2SampleDocLitServiceCallbackHandler()
{
@Override
public void
receiveErrorechoString(Exception e) {
System.out.println(e.getMessage());
}
@Override
public void
receiveResultechoString(
EchoStringReturnDocument result) {
System.out.println("Callback Handler called: " +
result.getEchoStringReturn());
completed= true;
}
};
stub.startechoString(reqDoc, handler);
stub._getServiceClient().getOptions().getTransportIn().getReceiver().destroy();
}catch(RemoteException fault) {
fault.printStackTrace();
} finally {
if(stub!=null) {
try{
*stub._getServiceClient().cleanupTransport();
*
}catch(AxisFault fault) {
// Nothing need to be done
}
}
}
}
}
Could please help how to do the clean of *âresponse streamâ *after getting
the reponse.
References followed:
http://axis.apache.org/axis2/java/core/docs/adv-userguide.html
http://amilachinthaka.blogspot.in/2010/01/improving-axis2-http-transport-client.html
--
Ashish Soni
Bangalore(Karnataka)- 560076
"A dream becomes a goal when action is taken toward its achievement."
Ashish Soni
Bangalore(Karnataka)- 560076
"A dream becomes a goal when action is taken toward its achievement."