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 Tim Lee <Ti...@smginc.com> on 2002/10/25 16:41:38 UTC

Header Question

I used WSDL2Java to generate stubs for my client.  However, the service I'm
working with requires a header.  I've attempted to set the header in the
stub class but I keep getting an API Exception.  Any ideas on what I"m doing
wrong:

My code:

            String checksum =  .........
            
            String headNmSpc = .......
            
            org.apache.axis.message.SOAPHeaderElement header = 
                new
org.apache.axis.message.SOAPHeaderElement(XMLUtils.StringToElement(headerNmS
pc,
                                                               "Security",
                                                               ""));
                                                               
            SOAPElement elemA = header.addChildElement("ClientID");
            elemA.addTextNode("timl");
            
            SOAPElement elemB = header.addChildElement("Checksum");
            elemB.addTextNode(checksum);
            
            org.apache.axis.client.Call _call =
                    (org.apache.axis.client.Call)
super.service.createCall();
                    
            _call.addHeader(header);



Here is the header from the WSDL from the service:

<s:element name="Security" type="s0:SecurityHeader" /> 
- <s:complexType name="SecurityHeader"> 
- <s:sequence> 
<s:element minOccurs="0" maxOccurs="1" name="ClientID" type="s:string" /> 
<s:element minOccurs="0" maxOccurs="1" name="Checksum" type="s:string" /> 
</s:sequence> 
</s:complexType>

***************************************************************************
The information contained in this message is intended only for the
confidential use of the recipient(s) named above. This message is privileged
and confidential. If the reader of this message is not the intended
recipient or any agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this document in
error and that any review, dissemination, distribution, or copying of this
message is strictly prohibited. If you have received this communication in
error, please notify us immediately. SMG reserves the right to monitor and
review all content sent to and from this email address. Messages sent to and
from this address may be stored on the SMG email system.