With JAX-WS, I think you can set a flag "header=true" in the web service
interface. Like:
public void someWebMethod(@WebParam(header=true) String myHeaderParam);
The targetNamespace/name can be added to the annotation to specify these
aspects.
In fact, if you start from WSDL, I'm pretty sure wsdl2java generates
such an interface for you.
kenkyee wrote:
I'm trying to make the soap header of WS client requests look like this
(adding the aws parameters to the soap:header):
http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?AuthJavaSampleSig2.html
<soap:Header
xmlns:aws="http://security.amazonaws.com/doc/2007-01-01/">
<aws:AWSAccessKeyId>1D9FVRAYCP1VJS767E02EXAMPLE</aws:AWSAccessKeyId>
<aws:Timestamp>2008-02-10T23:59:59Z</aws:Timestamp>
<aws:Signature>SZf1CHmQnrZbsrC13hCZS061ywsEXAMPLE</aws:Signature>
</soap:Header>
In the FAQ, there's a vague mention of mucking w/ the headers:
http://cxf.apache.org/faq.html#FAQ-HowcanIaddsoapheaderstotherequest%252Fresponse%253F
List<Header> headers = new ArrayList<Header>();
Header dummyHeader = new Header(new QName("uri:org.apache.cxf", "dummy"),
"decapitated",
new JAXBDataBinding(String.class));
headers.add(dummyHeader);
context.getMessageContext().put(Header.HEADER_LIST, headers);
But it doesn't describe how to get a context. Is this even the right API to
add parameters to the soap:header in the outgoing request?
Thanks in advance. I haven't been able to find anything related to this in
the archives of this list...