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 Bartolomeo Nicolotti <bn...@siapcn.it> on 2008/04/17 08:43:34 UTC

Re: Help with namespace problem in doWriteDefaultNs (Null Pointer Exception)

Hi,

i've had some problems with namespaces and prefixes using literal/doc
soap messages, and I've solved them substituting the axis2-saaj files
with sun's ones:

https://saaj.dev.java.net/

axis2-saaj-1.3.jar <--- saaj-impl.jar 
axis2-saaj-api-1.3.jar <--- saaj-api.jar

Bye!

Il giorno gio, 17/04/2008 alle 11.45 +0530, Deepal jayasinghe ha
scritto:
> Hi Amila
> 
> Any idea about this ?
> 
> Thank you!
> Deepal
> >
> >  
> >
> > I think I’ve narrowed down the cause of a problem I’m having, but I’m 
> > not sure what the solution is. . .any help would be **greatly** 
> > appreciated.
> >
> >  
> >
> > I’m trying to consume a web service that has published a pretty simple 
> > WSDL (attached).  There’s only one method exposed via the service, and 
> > it’s called “executeService” which takes a single argument (an XML 
> > string).
> >
> >  
> >
> > I installed Axis2 v1.2 in my Java 1.4 environment and ran this command:
> >
> > WSDL2Java -uri brms.wsdl -p com.foo.brms.serviceinterface -d xmlbeans 
> > -s -o ..\java -R ..\resources
> >
> >  
> >
> > That created a bunch of xmlbean supporting classes and a 
> > BRMSServiceStub.java.  Here’s how I’m using it:
> >
> >  
> >
> >     ExecuteServiceDocument executeServiceDoc = 
> > ExecuteServiceDocument.Factory./newInstance/( );
> >
> >     ExecuteService executeService = 
> > executeServiceDoc.addNewExecuteService( );
> >
> >     executeService.setArg0( . . . my Xml String here. . . );
> >
> >  
> >
> >     myBrmsServiceStub.executeService( executeServiceDoc );
> >
> >  
> >
> > The NPE stack trace that gets thrown is shown below, but I think the 
> > problem is that there is no namespace inserted into the surrounding 
> > xml that the generated xmlbeans class (ExecuteService) wraps around my 
> > XML.  Just before the executeService( ) call is made, here is the 
> > message content of the executeServiceDoc:
> >
> >  
> >
> > <?xml version='1.0' encoding='utf-8'?>
> >
> > <soapenv:Envelope 
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> >
> >     <soapenv:Body>
> >
> >         <executeService xmlns="http://endpoint.brmsservice/">    !!!!!
> >
> >             <arg0 xmlns="">
> >
> >                ...my Xml String here. . .
> >
> >             </arg0>
> >
> >         </executeService>
> >
> >     </soapenv:Body>
> >
> > </soapenv:Envelope>
> >
> >  
> >
> >  
> >
> >  
> >
> > Shouldn’t the "<executeService" element look more like this?
> >
> > <blah:executeService xmlns:blah="http://endpoint.brmsservice/">
> >
> >  
> >
> > I suspect that is the problem, because down in the stack when the 
> > doWriteDefaultNs is called, the default namespace is looked up from a 
> > map that maps the empty-string found in the executeService element to 
> > a null namespace value.
> >
> >  
> >
> > What did I do wrong?
> >
> >  
> >
> > Thanks in advance!
> >
> >  
> >
> >  
> >
> >  
> >
> >  
> >
> > java.lang.NullPointerException
> >
> >       at 
> > com.ctc.wstx.sw.BaseNsStreamWriter.doWriteDefaultNs(BaseNsStreamWriter.java:529)
> >
> >       at 
> > com.ctc.wstx.sw.SimpleNsStreamWriter.writeDefaultNamespace(SimpleNsStreamWriter.java:113)
> >
> >       at 
> > com.ctc.wstx.sw.SimpleNsStreamWriter.writeNamespace(SimpleNsStreamWriter.java:121)
> >
> >       at 
> > org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeNamespace(MTOMXMLStreamWriter.java:148)
> >
> >       at 
> > org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeElement(StreamingOMSerializer.java:238)
> >
> >       at 
> > org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(StreamingOMSerializer.java:71)
> >
> >       at 
> > org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(StreamingOMSerializer.java:54)
> >
> >       at 
> > org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMSerializerUtil.java:490)
> >
> >       at 
> > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:783)
> >
> >       at 
> > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:808)
> >
> >       at 
> > org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:234)
> >
> >       at 
> > org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:222)
> >
> >       at 
> > org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:808)
> >
> >       at 
> > org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:418)
> >
> >       at 
> > org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:55)
> >
> >       at 
> > org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
> >
> >       at 
> > org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:495)
> >
> >       at 
> > org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973)
> >
> >       at 
> > org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
> >
> >       at 
> > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
> >
> >       at 
> > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
> >
> >       at 
> > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
> >
> >       at 
> > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
> >
> >       at 
> > org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:558)
> >
> >       at 
> > org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:176)
> >
> >       at 
> > org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:73)
> >
> >       at 
> > org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:305)
> >
> >       at 
> > org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:201)
> >
> >       at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)
> >
> >       at 
> > org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
> >
> >       at 
> > org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
> >
> >       at 
> > com.xmradio.brms.serviceinterface.BRMSServiceStub.executeService(BRMSServiceStub.java:147)
> >
> >  
> >
> > **Tom Vaughan ****| **Technical Architect | direct 212 798 7367  | 
> > mobile 703 623 7101 | fax 212 966 6915  [Logo]
> >
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org