axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "nipa dadbhawala" <nipadadbhaw...@gmail.com>
Subject using custom handler to access soap header
Date Fri, 09 May 2008 18:50:53 GMT
Hi,

I have a web service and a test client. I have written a custom handler to
access custom soap header sent by the client. Following is the code snippet
in invoke method

public InvocationResponse invoke(MessageContext messageContext) throws
AxisFault
 {
     SOAPEnvelope env = messageContext.getEnvelope();
     SOAPHeader header = env.getHeader();

     System.out.println("Local name = " + header.getLocalName());
     System.out.println("Namespace = " + header.getNamespace());
     System.out.println("QName = " + header.getQName());
      System.out.println("Text = " + header.getText());

On the client side I have the code as follows to add the custom SOAP header.

SericeClient sc = myStub.getServiceClient();
sc.addStringHeader(new QName("http://www.CustomHeaders.com", "CustomHeader",
"CusotmNS"), "Some Information");

The values I am getting on the server side is as follows.

Local name = Header
Namespace = org.apache.axiom.om.impl.OMNamespaceImpl@212ecf42
QName = {http://schemas.xmlsoap.org/soap/envelope/}Header
Text =

On the server size I also tries this code and I am getting the size as zero.

ArrayList listHeaders = msgContext.getAxisMessage().getSoapHeaders();
            System.out.println("listHeaders size = " + listHeaders.size());
            for(int i =0; i< listHeaders.size(); i++)
            {
                SOAPHeaderMessage soapHeaderMsg =
(SOAPHeaderMessage)listHeaders.get(i);
                System.out.println("element = "
+soapHeaderMsg.getElement().toString());
                System.out.println("message = "
+soapHeaderMsg.getMessage().toString());
                System.out.println("Namespace URI = " +
soapHeaderMsg.getNamespaceURI());
            }

I do not see the header I am sending through my client. Can pl. someone help
me with this problem?

Thanks,
Nipa

Mime
View raw message