Hi Everybody,
I would like to modify the code generated by wsdl2java in order to have
a dual blocking client because the web service operation that I'm
calling is particularly time consuming. I had a look at the
EchoBlockingDualClient.java example and have come up with the following
code. But I get a null pointer exception.
Can someone please tell what I'm doing wrong?
Thanks very much!
Diego
=========================================================
Exception
=========================================================
Exception in thread "main" java.lang.NullPointerException
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:260)
at
org.astrodas.ws.peer.AstrodasPeerStub.insertMappingAnnotations(AstrodasPeerStub.java:128)
at
org.astrodas.ws.peer.AstrodasPeerProxy.insertMappingAnnotations(AstrodasPeerProxy.java:36)
at org.astrodas.test.Populate.populateLocal(Populate.java:239)
at org.astrodas.test.Populate.main(Populate.java:350)
=========================================================
Code
=========================================================
public InsertMappingAnnotationsResponseDocument
insertMappingAnnotations(InsertMappingAnnotationsDocument requestDoc)
throws RemoteException {
try {
OperationClient _operationClient =
_serviceClient.createClient(_operations[0].getName());
_operationClient.getOptions().setAction("insertMappingAnnotations");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
// Dual client
_operationClient.getOptions().setTransportInProtocol(Constants.TRANSPORT_HTTP);
_operationClient.getOptions().setUseSeparateListener(true);
_operationClient.getOptions().setAction("urn:echo");
_serviceClient.engageModule(new
javax.xml.namespace.QName(Constants.MODULE_ADDRESSING));
// create SOAP envelope with that payload
SOAPEnvelope env = null;
//Style is Doc.
env = toEnvelope(getFactory(_operationClient.getOptions()
.getSoapVersionURI()),
requestDoc,
optimizeContent(new
QName("","insertMappingAnnotations")));
// create message context with that soap envelope
MessageContext _messageContext = new MessageContext();
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
//execute the operation client
_operationClient.execute(true);
MessageContext _returnMessageContext =
_operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
Object object = fromOM(getElement(_returnEnv, "document"),
InsertMappingAnnotationsResponseDocument.class,
getEnvelopeNamespaces(_returnEnv));
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
return (InsertMappingAnnotationsResponseDocument) object;
} catch (AxisFault f) {...}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]