axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Vaughan" <Thomas.Vaug...@avenuea-razorfish.com>
Subject Help with namespace problem in doWriteDefaultNs (Null Pointer Exception)
Date Wed, 16 Apr 2008 17:01:54 GMT
Hi,

 

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.j
ava:529)

      at
com.ctc.wstx.sw.SimpleNsStreamWriter.writeDefaultNamespace(SimpleNsStrea
mWriter.java:113)

      at
com.ctc.wstx.sw.SimpleNsStreamWriter.writeNamespace(SimpleNsStreamWriter
.java:121)

      at
org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeNamespace(MTOMXMLStrea
mWriter.java:148)

      at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeElemen
t(StreamingOMSerializer.java:238)

      at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(S
treamingOMSerializer.java:71)

      at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(Strea
mingOMSerializer.java:54)

      at
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(OMS
erializerUtil.java:490)

      at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementI
mpl.java:783)

      at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(
OMElementImpl.java:808)

      at
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOA
PEnvelopeImpl.java:234)

      at
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPE
nvelopeImpl.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(SOAPMessage
Formatter.java:55)

      at
org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisReque
stEntity.java:84)

      at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequest
Body(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(HttpMe
thodDirector.java:397)

      at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho
dDirector.java:170)

      at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
96)

      at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
46)

      at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(Abstrac
tHTTPSender.java:558)

      at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:1
76)

      at
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:73)

      at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageW
ithCommons(CommonsHTTPTransportSender.java:305)

      at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common
sHTTPTransportSender.java:201)

      at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:452)

      at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper
ation.java:330)

      at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisO
peration.java:294)

      at
com.xmradio.brms.serviceinterface.BRMSServiceStub.executeService(BRMSSer
viceStub.java:147)

 

Tom Vaughan | Technical Architect | direct 212 798 7367  | mobile 703
623 7101 | fax 212 966 6915   

 


Mime
View raw message