Hi Folks,
Please can you help....I have generated a webservice client from a wsdl
using wsdl2java.
When the stub is used to invoke the webservice the following exception
occurs:
java.lang.NullPointerException
at com.sun.xml.stream.writers.UTF8OutputStreamWriter.write(
UTF8OutputStreamWriter.java:128)
at
com.sun.xml.stream.writers.XMLStreamWriterImpl.writeDefaultNamespace(
XMLStreamWriterImpl.java:728)
at com.sun.xml.stream.writers.XMLStreamWriterImpl.writeNamespace(
XMLStreamWriterImpl.java:914)
at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeNamespace(
MTOMXMLStreamWriter.java:146)
at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeElement(
StreamingOMSerializer.java:243)
at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serializeNode(
StreamingOMSerializer.java:76)
at
org.apache.axiom.om.impl.serialize.StreamingOMSerializer.serialize(
StreamingOMSerializer.java:59)
at
org.apache.axiom.om.impl.util.OMSerializerUtil.serializeByPullStream(
OMSerializerUtil.java:473)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(
OMElementImpl.java:823)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(
OMElementImpl.java:848)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(
OMElementImpl.java:819)
at
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(
SOAPEnvelopeImpl.java:180)
at
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(
OMElementImpl.java:848)
at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(
OMNodeImpl.java:419)
at
org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.handleOMOutput
(SOAPOverHTTPSender.java:190)
at
org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.writeRequest
(SOAPOverHTTPSender.java:232)
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:541)
at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(
SOAPOverHTTPSender.java:119)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons
(CommonsHTTPTransportSender.java:335)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke
(CommonsHTTPTransportSender.java:204)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
at org.apache.axis2.description.OutInAxisOperationClient.send(
OutInAxisOperation.java:237)
at org.apache.axis2.description.OutInAxisOperationClient.execute(
OutInAxisOperation.java:202)
at
com.madeupnamexyz.appproviders.generated.wssms.send.SmsSendServiceStub.SendSms
(SmsSendServiceStub.java:171)
However, if I modify the stub by adding....
System.out.println("ENVELOPESTARTS:");
try
{
env.serialize(System.out);
}
catch(javax.xml.stream.XMLStreamException ex)
{
System.out.println(ex.toString());
}
System.out.println(":ENVELOPEENDS:");
....(i.e. I serialize the envelope to stdout) before the OperationClient
execute method is called by the stub, the operation completes successfully.
The WSDL and associated XSDs validate and wsdl2java gives no errors, so it
looks like env.serialize() is fixing something in the envelope!
The code using the client stub does not set anything to null and the output
from env.serialize() shows a valid soap envelope with all the expected
fields populated with valid values.
Has anyone else experienced this?
Is this a known issue?
Many Thanks,
Darren