On Thursday 18 March 2010 3:09:26 pm Remijan, Michael wrote:
> I need to add a header to my clients web service call request and the
> header is not defined in the WSDL.  I found this similar question posted
> in 2007
> 
> http://old.nabble.com/Add-SOAP-HEADER-value-ts11710546.html#a11710546
> 
> In this post the solution was to go back to the basic org.w3c.dom.Document
> and org.w3c.dom.Element objects and then add them using
> BindingProvider.getRequestContext().put(Header.HEADER_LIST,
> listOfSoapHeaderObjects);.
> 
> My question is, is this the easiest way?  It seems very obscure way of
> adding soap headers.

Well, the "JAX-WS standard" way is to write a SOAPHandler and ad your header 
with that.   That is standard, but generally a pain.   Thus, each JAX-WS 
provider has added proprietary ways to do it. 

You don't "need" to do the dom thing.   The Header  object can take any Object 
and a DataBinding object that would know how to write it.  You could create a 
JAXBDataBinding object with a Set of classes or even a JAXBContext and then 
pass that in.   A little less DOM usage and would allow streaming.



-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

Reply via email to