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

Reply via email to