You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Kartheek Hirode <ka...@centegy.com> on 2001/05/22 20:56:49 UTC

API to access SOAP-Headers in RPCRouterServlet

What is the best way to access the SOAP headers in an Envelope? My envelope
as seen on TcpTunnelGui is as below. As you can see, the SOAP-ENV:Headers
are in there.
But when I try to access them in the RPCRouterServlet, it throws an
Exception.
Thanks for any leads,
--KH

Here's the code to access the Header:
 try{
  java.util.Vector hVec=callEnv.getHeader().getHeaderEntries();
  String hStr="Header entries:\n";
  for(Enumeration e=hVec.elements(); e.hasMoreElements(); ){
   hStr += (String)e.nextElement();
  }
  System.out.println(hStr);
  }
  catch(Throwable e){
    System.out.println("Exception thrown during retrieval of "+
                     "SOAP Header from Call Envelope: "+e.getMessage());
  }

This is the complete SOAP Envelope from TcpTunnelGui:
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  <SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">

  <SOAP-ENV:Header
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <DigitalCert>asdfasdf</DigitalCert>
    <AdditionalInfo>asdfasdf</AdditionalInfo>
  </SOAP-ENV:Header>

  <SOAP-ENV:Body>
    <ns1:MyTopic xmlns:ns1="MyTopic"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <PayloadString xsi:type="xsd:string">
	  Trial payload
      </PayloadString>
    </ns1:MyTopic>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org