Hi,
Editing the generated stubs is not recommended... you can try code
generating giving the -a option to the wsdl2java.. It'll generate the
async code together with CallBacks...
Normally the async invocation methods of the operations are named as
start<operationname>..
~Thilina
On 1/30/07, W.Y. Ho <[EMAIL PROTECTED]> wrote:
Hi,
I build my web services using Axis2 + XmlBeans (XML Data binding).
I used the "Code first approach" (Starting from a service source code) +
Java2WSDL, using Axis2 Codegen Wizard (eclipse plugins)
Everything is working fine.
I'm thinking now to control the client call operations (Sync vs. Async).
Looking at the automatic generated stub class, I'm not sure which operations
the stub is implementing.
I observed the following calls to the server.
org.apache.axis2.client.OperationClient calls
execute(true).
How can I change this into non-blocking with callbacks?
Thanks,
wen
Below is the code snippet:
public TDTradeServicesResultDocument processTrade(MyXmlDocument param0)
throws java.rmi.RemoteException,
org.tds.eqd.webServices.exception.ProcessTradeFaultException{
try{
org.apache.axis2.client.OperationClient
_operationClient =
_serviceClient.createClient(_operations[0].getName());
_operationClient.getOptions().setAction("urn:processTrade");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null;
//Style is Doc.
env = toEnvelope(
getFactory(
_operationClient.getOptions().getSoapVersionURI()),
param0,
optimizeContent(new
javax.xml.namespace.QName("","processTrade")
)
);
// adding SOAP headers
_serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
org.apache.axis2.context.MessageContext
_messageContext =
new
org.apache.axis2.context.MessageContext() ;
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
//execute the operation client
_operationClient.execute(true);
org.apache.axis2.context.MessageContext
_returnMessageContext =
_operationClient.getMessageContext(
org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axiom.soap.SOAPEnvelope _returnEnv =
_returnMessageContext.getEnvelope();
java.lang.Object object = fromOM(
_returnEnv.getBody().getFirstElement(),
TDTradeServicesResultDocument.class,
getEnvelopeNamespaces(_returnEnv)
);
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
return (TDTradeServicesResultDocument)object;
} catch(org.apache.axis2.AxisFault f){
________________________________
Share your photos with the people who matter at Yahoo! Canada Photos
--
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]