You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Diego <di...@tiscalinet.it> on 2006/05/01 01:07:24 UTC

[axis2 1.0 RC4] blocking dual client - null pointer exception

Hi everybody!

I added the lines between the comments to the code generated by the wsdl 
2java in order to have a blocking dual transport client.  But I get a 
null pointer exception.

Thanks for any help!

Diego


Exception:
==========

Exception in thread "main" java.lang.NullPointerException
         at 
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:259)
         at 
org.astrodas.ws.peer.AstrodasPeerStub.insertMappingAnnotations(AstrodasPeerStub.java:122)
         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 org.astrodas.ws.model.InsertMappingAnnotationsResponseDocument 
insertMappingAnnotations(
     org.astrodas.ws.model.InsertMappingAnnotationsDocument param4)
     throws java.rmi.RemoteException {
     try {
         org.apache.axis2.client.OperationClient _operationClient = 
_serviceClient.createClient(_operations[0].getName());
 
_operationClient.getOptions().setAction("insertMappingAnnotations");
 
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
 
//====================================================================================
         // Dual client lines added
 
//==================================================================================== 

 
_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));
 
//====================================================================================
         // Dual client lines added
 
//====================================================================================
         // create SOAP envelope with that payload
         org.apache.axiom.soap.SOAPEnvelope env = null;
         //Style is Doc.
         env = toEnvelope(getFactory(_operationClient.getOptions()
                                                     .getSoapVersionURI()),
                 param4,
                 optimizeContent(
                     new javax.xml.namespace.QName("",
                         "insertMappingAnnotations")));
         // 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(getElement(_returnEnv, 
"document"),
 
org.astrodas.ws.model.InsertMappingAnnotationsResponseDocument.class);
 
_messageContext.getTransportOut().getSender().cleanUp(_messageContext);
         return 
(org.astrodas.ws.model.InsertMappingAnnotationsResponseDocument) object;
     } catch (org.apache.axis2.AxisFault f) {
         ...
     }