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 Brian Madigan <bu...@yahoo.com> on 2003/01/17 23:24:04 UTC

MessageContext and OperationDesc

Handler implementation question:
Do MessageContext instances that get passed to
Handlers have an OperationDesc? I see that
OperationDesc is a 'Work in progress' in the API. Is
there a way (that works) to get the name of the
operation in the current MessageContext? (from within
a Handler)

Also, how volatile can I expect MessageContext to be?
Should I keep it in hidden in my handler or is it
closed enough to change that I could depend on it to
some degree?

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

How to add a SOAP header into a SOAP envelope ??

Posted by Ricky Ho <ri...@cisco.com>.
I try to add a SOAP header into a SOAP envelope.

1) SOAPEnvelope soapEnv = .... ;
2) System.out.println("SoapEnv is ..\n" + soapEnv);
3) SOAPHeaderElement hdrElement = new SOAPHeaderElement(new 
PrefixedQName("myNamespace","someHeader", "prefix"));
4) soapEnv.addHeader(hdrElement);
5) System.out.println("SoapEnv is ..\n" + soapEnv);

At line 2, I get ...

SoapEnv is ..
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
   <ns1:getTemp 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns1="urn:xmethods-Temperature">
    <zipcode xsi:type="xsd:string">95135</zipcode>
   </ns1:getTemp>
  </soapenv:Body>
</soapenv:Envelope>

But I get an Exception after line 4

Exception:
java.lang.NullPointerException
         at org.apache.axis.message.SOAPHeader.outputImpl(SOAPHeader.java:330)
         at 
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:395)
         at 
org.apache.axis.message.MessageElement.output(MessageElement.java:754)
         at 
org.apache.axis.message.MessageElement.getAsString(MessageElement.java:677)
         at 
org.apache.axis.message.MessageElement.toString(MessageElement.java:805)
         at java.lang.String.valueOf(String.java:2146)
         at java.lang.StringBuffer.append(StringBuffer.java:372)
         at myMethod

At line 5, I get the following

SoapEnv is ..
null

What have I done wrong ??

Rgds, Ricky