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 Shah Asrani <sh...@gmail.com> on 2008/12/30 15:17:18 UTC
SOAP Header issue.
I am using operation client and building the soap request message with
some headers.
I add the header as follows:
soapHeader = soapEnvelope.getHeader();
for( int i=0; i<headers.size(); i++){
Mydata hdrs = (MyData)headerList.get(i);
OMElement hdr = (OMElement)
AXIOMUtil.stringToOM(hdrs.toXmlString(myObject));
Iterator iter = hdr.getChildren();
SOAPHeaderBlock shb =
soapFactory.createSOAPHeaderBlock(hdr.getLocalName(),
hdr.getNamespace());
while(iter.hasNext())
{
shb.addChild((OMNode) iter.next());
}
soapHeader.addChild(shb);
}
if there is only one header, then everything works fine. however, if
I add more that one headers (i.e. the for loop iterates more than
once),
then, the following exception occurs when invoking the service
line of code : operationClient.execute(true);
java.lang.NullPointerException
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getPrintableName(OMSourcedElementImpl.java:147)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:659)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:918)
at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:240)
Any Ideas?
Shah
Re: SOAP Header issue.
Posted by Andreas Veithen <an...@gmail.com>.
The NullPointerException has been recently fixed in Axiom (see
revision 718053). You might want to try with a snapshot version of
Axiom. Note that I don't think the issue in Axiom is the root cause of
your problem, but trying with a snapshot version might help you to
better understand the problem.
Andreas
On Tue, Dec 30, 2008 at 15:17, Shah Asrani <sh...@gmail.com> wrote:
> I am using operation client and building the soap request message with
> some headers.
> I add the header as follows:
>
> soapHeader = soapEnvelope.getHeader();
> for( int i=0; i<headers.size(); i++){
> Mydata hdrs = (MyData)headerList.get(i);
> OMElement hdr = (OMElement)
> AXIOMUtil.stringToOM(hdrs.toXmlString(myObject));
> Iterator iter = hdr.getChildren();
> SOAPHeaderBlock shb =
> soapFactory.createSOAPHeaderBlock(hdr.getLocalName(),
> hdr.getNamespace());
> while(iter.hasNext())
> {
> shb.addChild((OMNode) iter.next());
> }
> soapHeader.addChild(shb);
> }
>
> if there is only one header, then everything works fine. however, if
> I add more that one headers (i.e. the for loop iterates more than
> once),
> then, the following exception occurs when invoking the service
>
> line of code : operationClient.execute(true);
>
> java.lang.NullPointerException
> at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.getPrintableName(OMSourcedElementImpl.java:147)
> at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:659)
> at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:918)
> at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:947)
> at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:240)
>
> Any Ideas?
>
> Shah
>