cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: how do you add parameters to soap:header in CXF generated WS client?
Date Mon, 14 Dec 2009 15:04:46 GMT

Ideally, their WSDL would have defined soap:header things in the binding and 
then you could pass "-exsh true" to the code generator to add params for them 
automatically.  However, their wsdl doesn't seem to do that.   I personally 
think the hardest part of dealing with WebServices is dealing with crappy 
WSDL's.    Contract first development is only as good as the contract.   
Crappy contract, crappy dev experience.  :-(

In anycase, since the wsdl sucks, you would need to drop to the API's listed 
in the FAQ.   On the client side, the context would be the request context:

((BindingProvider)proxy).getRequestContext().put(HEADER_LIST, headers);

Dan



On Sat December 12 2009 10:56:23 pm 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%252Fre
> sponse%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...
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message