You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "ravi.4indra" <ra...@gmail.com> on 2012/10/15 04:26:27 UTC

Camel CXF Compnenent consuming a webservice having header of type X.(X maps to xsd)

Hi 

it would be helpful to me if anyone can let me know if there is a way of
calling a webservice using camel cxf component with header of some type say
X . X is the schema in some namespace. 

Any help in this is appreciated.

Thanks
ravi



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Compnenent-consuming-a-webservice-having-header-of-type-X-X-maps-to-xsd-tp5721039.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF Compnenent consuming a webservice having header of type X.(X maps to xsd)

Posted by Willem jiang <wi...@gmail.com>.
Which data formate are you using?
You are just want o access the soap header there.

BTW, if you want to access the CXF message from camel in message, you can do it like this
 
org.apache.cxf.message.Message cxfMessage = in.getHeader(CxfConstants.CAMEL_CXF_MESSAGE, org.apache.cxf.message.Message.class);



Then you can tried to access the Headers like this
> List<Header> soapHeaders = (List<Header>)
> cxfMessage.getHeader(Header.HEADER_LIST)




-- 
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang





On Tuesday, October 16, 2012 at 2:18 AM, ravi.4indra wrote:

> Hi Willem,
> 
> Thanks for the reply . below is my code to insert SOAP headers
> 
> List<Header> soapHeaders = new ArrayList<Header>();
> Header controller270Header = new Header(new
> QName("nameSpace","RequestHeaders"),requestHeaders, new
> JAXBDataBinding(RequestHeaders.class));
> soapHeaders.add(controller270Header);
> 
> Now I have the List of Headers(soapHeaders). How do i add this to camel
> exchange?
> I tried
> List<Header> soapHeaders = (List<Header>)
> exchange.getIn().getHeader(Header.HEADER_LIST). but i am getting soapHeaders
> as null.
> 
> Thanks again!!
> 
> Ravi
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Compnenent-consuming-a-webservice-having-header-of-type-X-X-maps-to-xsd-tp5721039p5721070.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Camel CXF Compnenent consuming a webservice having header of type X.(X maps to xsd)

Posted by "ravi.4indra" <ra...@gmail.com>.
Hi Willem,

Thanks for the reply . below is my code to insert SOAP headers

List<Header> soapHeaders = new ArrayList<Header>();
 Header controller270Header = new Header(new
QName("nameSpace","RequestHeaders"),requestHeaders, new
JAXBDataBinding(RequestHeaders.class));
soapHeaders.add(controller270Header);

Now I have the List of Headers(soapHeaders). How do i add this to camel
exchange?
I tried
List<Header> soapHeaders =  (List<Header>)
exchange.getIn().getHeader(Header.HEADER_LIST). but i am getting soapHeaders
as null.

Thanks again!!

Ravi



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Compnenent-consuming-a-webservice-having-header-of-type-X-X-maps-to-xsd-tp5721039p5721070.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel CXF Compnenent consuming a webservice having header of type X.(X maps to xsd)

Posted by Willem jiang <wi...@gmail.com>.
Hi,

I'm not sure what kind of header you want to put.
Is it a soap header or just a http header ?
For the soap header you can take a look at this thread[1]
For the http header, you can take a look at the code here[2]

[1]http://cxf.547215.n5.nabble.com/add-namespace-to-soap-header-td5716003.html 
[2]https://svn.apache.org/repos/asf/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfProducerContextTest.java
-- 
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang




On Monday, October 15, 2012 at 10:26 AM, ravi.4indra wrote:

> Hi 
> 
> it would be helpful to me if anyone can let me know if there is a way of
> calling a webservice using camel cxf component with header of some type say
> X . X is the schema in some namespace. 
> 
> Any help in this is appreciated.
> 
> Thanks
> ravi
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-CXF-Compnenent-consuming-a-webservice-having-header-of-type-X-X-maps-to-xsd-tp5721039.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).