users@jax-rpc.java.net

Re: Add Header tp SOAP with SOAPElement API

From: manoj cheenath <manojc_at_BEA.COM>
Date: Wed, 19 Jun 2002 11:27:14 -0700

Try this:

SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
SOAPElement header = envelope.getHeader();

header.addChildElement(
  envelope.createName( "Signature", "ds",
"http://www.w3.org/2000/09/xmldsig") );

I never tried this on RI, but this works on weblogic JAX-RPC implementation.

regards,
-manoj



----- Original Message -----
From: <yawningrascal_at_HOTMAIL.COM>
To: <JAXRPC-INTEREST_at_JAVA.SUN.COM>
Sent: Wednesday, June 19, 2002 3:54 AM
Subject: Add Header tp SOAP with SOAPElement API


> Hi,
>
> I created a JAX-RPC Service and now I want to add Metadata to the SOAP
Header
> concerning digital signatures. For that reason I created a
SOAPMessageHandler
> to intercept the SOAP Message. At this point I want to use the SOAPElement
API to add my own header to the Message. First I inspected the SOAP Message
> with a TCP/IP Tool and were no headers in my SOAP Requests. (How can I
force
> JAX-RPC to add an empty standard header to a soap message?). So I tried
the following with my handler:
>
> Name nsSignature =
se.createName("Signature","ds","http://www.w3.org/2000/09/xmldsig");
>
> se.getHeader().detachNode();
> SOAPHeader sh = se.addHeader();
> sh.addHeaderElement(nsSignature);
>
> Unfortunately no header appeared in the soap message.
> Anyone out there who knows how this could work?
> Thanx, Mischa
>