You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Akshat Tandon <ak...@gmail.com> on 2014/01/06 11:46:58 UTC

Camel cxf with basic authentication

Hi All,

I'm new to Apache Camel and CXF,

I'm trying to create a route for querying a remote WS which requires Basic
Authentication and to specify the SoapAction header.

I was able to achieve the same using camel http component but i needed the
same with camel cxf in java dsl .


Example the sample url is

https://demo017.service-now.com/u_ntq001.do?WSDL

username/password ==> admin/admin

Can anyone guide us in fixing the same


*Thanks and RegardsAkshat Tandon*

Re: Camel cxf with basic authentication

Posted by Willem Jiang <wi...@gmail.com>.
It could be difficult to access the wsdl if you don’t setup the http conduit for it.

You can setup the by setting the CxfEndpoint property like this

CxfEndpoint cxfEndpoint = camelContext.getEndpoint(“cxf:xxx”);
// set the authentication information
Map<String, Object> properties = new HashMap<String, Object>();
  
org.apache.cxf.configuration.security.AuthorizationPolicy authPolicy = new AuthorizationPolicy();
authPolicy.setUserName(username);
authPolicy.setPassword(password);
properties.put(AuthorizationPolicy.class.getName(), authPolicy);

cxfEndpoint.setProperties(properties);    

from(“xxx”).to(cxfEndpoint);


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 7, 2014 at 7:10:44 PM, akshattandon (akshat.mbx@gmail.com) wrote:
>  
> Thanks Jiang for the response
>  
> can you please provide the java dsl code to achieve the same as  
> we don't use
> spring .
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-cxf-with-basic-authentication-tp5745620p5745666.html  
> Sent from the Camel - Users mailing list archive at Nabble.com.  
>  


Re: Camel cxf with basic authentication

Posted by akshattandon <ak...@gmail.com>.
Thanks Jiang for the response 

can you please provide the java dsl code to achieve the same as we don't use
spring . 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-cxf-with-basic-authentication-tp5745620p5745666.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel cxf with basic authentication

Posted by Willem Jiang <wi...@gmail.com>.
You can add below lines into the spring configuration file

<conduit name=“*.http-conduit"
  xmlns:sec="http://cxf.apache.org/configuration/security"
  xmlns="http://cxf.apache.org/transports/http/configuration">
  <authorization>
     <sec:UserName>myuser</sec:UserName>
     <sec:Password>mypasswd</sec:Password>
     <sec:AuthorizationType>Basic</sec:AuthorizationType>
  </authorization>
</conduit>

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On January 6, 2014 at 6:50:52 PM, Akshat Tandon (akshat.mbx@gmail.com) wrote:
>  
> Hi All,
>  
> I'm new to Apache Camel and CXF,
>  
> I'm trying to create a route for querying a remote WS which requires  
> Basic
> Authentication and to specify the SoapAction header.
>  
> I was able to achieve the same using camel http component but i  
> needed the
> same with camel cxf in java dsl .
>  
>  
> Example the sample url is
>  
> https://demo017.service-now.com/u_ntq001.do?WSDL
>  
> username/password ==> admin/admin
>  
> Can anyone guide us in fixing the same
>  
>  
> *Thanks and RegardsAkshat Tandon*
>