You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by shadowlaw <ay...@gmail.com> on 2012/11/14 15:53:55 UTC
cxf wsdl2java generated client security
Hi,
I used cxf generator to generate à client ws, this web service needs to
authenticate using http basic authentication i used this code:
serviceName = new QName(NAMESPACE_URI, SERVICE_NAME);
javax.xml.ws.Service service = Service.create(WSDL_LOCATION,
serviceName);
final AdaConfigDataFactory port =
service.getPort(AdaConfigDataFactory.class);
BindingProvider bindingProvider = (BindingProvider)port;
Map requestContext = bindingProvider.getRequestContext();
requestContext.put(BindingProvider.USERNAME_PROPERTY, "username");
requestContext.put(BindingProvider.PASSWORD_PROPERTY, "password");
but when monitoring the sent request i can see that authentication
credentials are not beeing sent to server, is there any issue in my code?
i'm considering using the JaxWsProxyFactoryBean for the client part, but is
there any difference in performance between the two methods?
thanks
--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-wsdl2java-generated-client-security-tp5718438.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf wsdl2java generated client security
Posted by Glen Mazza <gm...@talend.com>.
Hmm. You might want to try to run my blog sample directly (the source
code is available) to see if *that* sending the username and password,
and if so, what the difference is between the sample and your work. I
assume your SOAP calls are indeed failing, right, the server is
rejecting them due to no authentication being provided? (i.e., the
server is configured to require basic auth).
Glen
On 11/14/2012 10:50 AM, shadowlaw wrote:
> actually it's a http based authentification therefore using tcpmon i can see
> the request sent to the server which is containing a http header resembling
> Authorization=[Basic TTEwLU0xMF9DVEw6Yl98NUd0Qks=]
>
> but in my case i don't see anything.
> the code i showed is based on the sample project from your blog.
>
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-wsdl2java-generated-client-security-tp5718438p5718448.html
> Sent from the cxf-user mailing list archive at Nabble.com.
--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza
Re: cxf wsdl2java generated client security
Posted by shadowlaw <ay...@gmail.com>.
actually it's a http based authentification therefore using tcpmon i can see
the request sent to the server which is containing a http header resembling
Authorization=[Basic TTEwLU0xMF9DVEw6Yl98NUd0Qks=]
but in my case i don't see anything.
the code i showed is based on the sample project from your blog.
--
View this message in context: http://cxf.547215.n5.nabble.com/cxf-wsdl2java-generated-client-security-tp5718438p5718448.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: cxf wsdl2java generated client security
Posted by Glen Mazza <gm...@talend.com>.
I'm not sure how your monitoring could tell you whether those values are
being sent to the server, as it would presumably be encrypted via SSL
and hence unreadable. Have you been able to get the wsdl_first_https
sample in the CXF distribution to work? I would start with that. My
tutorial ( http://www.jroller.com/gmazza/entry/ssl_for_web_services) may
also be of help, but offhand, your code looks correct.
Glen
On 11/14/2012 09:53 AM, shadowlaw wrote:
> Hi,
>
> I used cxf generator to generate à client ws, this web service needs to
> authenticate using http basic authentication i used this code:
>
> serviceName = new QName(NAMESPACE_URI, SERVICE_NAME);
> javax.xml.ws.Service service = Service.create(WSDL_LOCATION,
> serviceName);
> final AdaConfigDataFactory port =
> service.getPort(AdaConfigDataFactory.class);
> BindingProvider bindingProvider = (BindingProvider)port;
> Map requestContext = bindingProvider.getRequestContext();
> requestContext.put(BindingProvider.USERNAME_PROPERTY, "username");
> requestContext.put(BindingProvider.PASSWORD_PROPERTY, "password");
>
> but when monitoring the sent request i can see that authentication
> credentials are not beeing sent to server, is there any issue in my code?
>
> i'm considering using the JaxWsProxyFactoryBean for the client part, but is
> there any difference in performance between the two methods?
>
> thanks
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/cxf-wsdl2java-generated-client-security-tp5718438.html
> Sent from the cxf-user mailing list archive at Nabble.com.
--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza