You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Frank61 <de...@hotmail.com> on 2007/09/20 18:45:24 UTC

Basic authentication with CXF

Hi !

I am making a web service client using CXF framework
I have made  Java classes using wsdl2Java.

It generated me java files:

MyWs_Service.java
MyWs.java
ObjectFactory.java
... and Request and ResponseType java files

I am using those classes as.

ObjectFactory factory = new ObjectFactory();
MyWs_Service myWs= new MyWs_Service().getMyWsSOAP();
mySearchRequestType mySearch = factory.createMySearchRequestType();
mySearch.setName("12374");
mySearchResponseType myRes = myWs.searchIdByName(mySearch);

The service requires HTTP Basic Autenthication so
how can add this feature  to my program?


Frank







-- 
View this message in context: http://www.nabble.com/Basic-authentication-with-CXF-tf4488719.html#a12801114
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Basic authentication with CXF

Posted by Daniel Kulp <dk...@apache.org>.
Basic Auth is required for JAX-WS and is part of the specification:

ObjectFactory factory = new ObjectFactory();
MyWs_Service myWs= new MyWs_Service().getMyWsSOAP();
BindingProvider bp = (BindingProvider)myWs;
bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "BJ");
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");

Dan



On Thursday 20 September 2007, Frank61 wrote:
> Hi !
>
> I am making a web service client using CXF framework
> I have made  Java classes using wsdl2Java.
>
> It generated me java files:
>
> MyWs_Service.java
> MyWs.java
> ObjectFactory.java
> ... and Request and ResponseType java files
>
> I am using those classes as.
>
> ObjectFactory factory = new ObjectFactory();
> MyWs_Service myWs= new MyWs_Service().getMyWsSOAP();
> mySearchRequestType mySearch = factory.createMySearchRequestType();
> mySearch.setName("12374");
> mySearchResponseType myRes = myWs.searchIdByName(mySearch);
>
> The service requires HTTP Basic Autenthication so
> how can add this feature  to my program?
>
>
> Frank



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: Basic authentication with CXF

Posted by blakevh <bv...@apexit.com>.
You need to set up a conduit to support Basic authentication.

See http://cwiki.apache.org/CXF20DOC/client-http-transport.html and then
Google http:authorization since the documentation seems to be a little thin
yet.


Something like:

<http:conduit name="{http://some.com/service}port.http-conduit">
    <http:authorization>
     <sec:UserName>firefly</sec:UserName>
     <sec:Password>serenity</sec:Password>
    </http:authorization>
  </http:conduit>


Frank61 wrote:
> 
> Hi !
> 
> I am making a web service client using CXF framework
> I have made  Java classes using wsdl2Java.
> 
> 
> The service requires HTTP Basic Autenthication so
> how can add this feature  to my program?
> 
> 
> Frank
> 

-- 
View this message in context: http://www.nabble.com/Basic-authentication-with-CXF-tf4488719.html#a12806626
Sent from the cxf-user mailing list archive at Nabble.com.