You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by am am <ak...@yahoo.com> on 2010/06/23 21:16:48 UTC

CXF/HTTP

Hi,
I would like to know if it is possible in cxf to add a request parameter to the HTTP portion of a message, send from a client to a web service.
My intention is to make a web service function call and in the message send, place in the http header an IP and port to a web service so that a module in the service part will send messages. I can not send this info through a parameter in the web service method since the wsdl does not allow me that, and I can not modify the wsdl. Can I do this using cxf?

Thanks



      

Re: CXF/HTTP

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 23 June 2010 3:16:48 pm am am wrote:
> Hi,
> I would like to know if it is possible in cxf to add a request parameter to
> the HTTP portion of a message, send from a client to a web service. My
> intention is to make a web service function call and in the message send,
> place in the http header an IP and port to a web service so that a module
> in the service part will send messages. I can not send this info through a
> parameter in the web service method since the wsdl does not allow me that,
> and I can not modify the wsdl. Can I do this using cxf?

You do have two options:

1) Use a SOAP header.  The faq:
http://cxf.apache.org/faq.html#FAQ-
HowcanIaddsoapheaderstotherequest%252Fresponse%253F
desribes some ways to add soap headers that really don't have an impact on the 
wsdl.

2) You can set an HTTP header as you describe.  From the port proxy, you can 
do:
Map<String, List<String>> headers = new ....
...   add headers to headers map ....
((BindingProvider)port).getRequestContext()
    .put(MessageContext.HTTP_REQUEST_HEADERS, headers);



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