cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Consuming a WebService with NTML authentication
Date Wed, 31 Aug 2011 20:29:08 GMT
On Tuesday, August 30, 2011 3:12:11 PM jp_listero wrote:
> ok.
> 
> but using cxf apache ?
> 
> I'am following http://cxf.apache.org/docs/how-do-i-develop-a-client.html
> where I set user & password ?

If you have the port/proxy, just use:

((BindingProvider)proxy).getRequestContext()
	.put(BindingProvider.USERNAME_PROPERTY, username);
((BindingProvider)proxy).getRequestContext()
	.put(BindingProvider.PASSWORD_PROPERTY, pwd);

Dan


> 
> thanks a lot !
> 
> 2011/8/30 Daniel Kulp <dkulp@apache.org>:
> > On Tuesday, August 30, 2011 2:42:16 PM jp_listero wrote:
> >> Daniel, thanks for your anwser.
> >> so ...
> >> I need to implement a ws client soap that have NTLM authentication ...
> >>  What do you technology recommend that I use ? Maybe you hace some
> >> guide or tuto.
> > 
> > Java 6 contains built in support for NTLM.  Thus, you should just need
> > to set the username/password on the client like normal, most likely
> > turn off the chunking and turn on the auto-redirect.   That should just
> > work and people have confirmed that.
> > 
> > Dan
> > 
> >> thanks a lot.
> >> JP
> >> 
> >> 2011/8/30 Daniel Kulp <dkulp@apache.org>:
> >> > On Tuesday, August 30, 2011 12:09:04 AM jp_listero wrote:
> >> >> I think I have bad set my Url ...
> >> >> now I have other Exception:
> >> >> 
> >> >> 
> >> >> INFO: Creating Service
> >> >> {http://tempuri.org/action/}WsPresC1SoapPortService from class
> >> >> org.tempuri.action.WsPresC1SoapPort
> >> >> 30-ago-2011 0:06:09 org.apache.cxf.phase.PhaseInterceptorChain
> >> >> doIntercept ADVERTENCIA: Interceptor has thrown exception,
> >> >> unwinding
> >> >> now
> >> >> org.apache.cxf.interceptor.Fault: Response was of unexpected
> >> >> text/html ContentType.  Incoming portion of HTML stream: < ...
> >> >> 
> >> >> some Ideas ?
> >> > 
> >> > Honestly, I have no idea.  Maybe enable the logging stuff to see
> >> > the
> >> > full
> >> > incoming stream, but it looks like it's not working.
> >> > 
> >> > With NTLM built into the JDK, I haven't seen anyone really try to
> >> > use
> >> > jcifs with CXF latetly.
> >> > 
> >> > Dan
> >> > 
> >> >> thanks!
> >> >> 
> >> >> 2011/8/27 jp_listero <jplistero@gmail.com>:
> >> >> > Hi all,
> >> >> > 
> >> >> > I' am trying to develop a client web service with NTML
> >> >> > authenticatiom.
> >> >> > I use cxf + jcifs ...
> >> >> > 
> >> >> > here is some code client:
> >> >> > 
> >> >> > public void CreateClient() {
> >> >> > 
> >> >> >     JaxWsProxyFactoryBean factoryBean = new
> >> >> > JaxWsProxyFactoryBean();
> >> >> >     factoryBean.setServiceClass(XXXSoapPort.class);
> >> >> >     factoryBean.setAddress(URL);
> >> >> > 
> >> >> >     jcifs.Config.setProperty("jcifs.smb.client.domain",
> >> >> > "xxy");
> >> >> >     jcifs.Config.setProperty("jcifs.netbios.wins",
> >> >> > "172.16.3.243");
> >> >> >     jcifs.Config.setProperty("jcifs.smb.client.soTimeout",
> >> >> > "300000");
> >> >> > //5
> >> >> > 
> >> >> >    jcifs.Config.setProperty("jcifs.netbios.cachePolicy",
> >> >> > "1200");
> >> >> > //20
> >> >> > minutes
> >> >> > jcifs.Config.setProperty("jcifs.smb.client.username",
> >> >> > "uuu");
> >> >> > jcifs.Config.setProperty("jcifs.smb.client.password",
> >> >> > "secret");
> >> >> > 
> >> >> >  //Register the jcifs URL handler to enable NTLM
> >> >> >   jcifs.Config.registerSmbURLHandler();
> >> >> > 
> >> >> >   HTTPClientPolicy httpClientPolicy = new
> >> >> > HTTPClientPolicy();
> >> >> > 
> >> >> >   httpClientPolicy.setAllowChunking(false);
> >> >> > 
> >> >> >    XXXSoapPort service =  (XXXSoapPort)factoryBean.create();
> >> >> > 
> >> >> > 
> >> >> > ((HTTPConduit)factoryBean.getClientFactoryBean().getClient()
> >> >> > .getCo
> >> >> > nduit ()).setClient(httpClientPolicy); }
> >> >> > 
> >> >> > 
> >> >> > when I invoke I have this exception:
> >> >> > 
> >> >> > 
> >> >> > 27-ago-2011 13:27:54
> >> >> > org.apache.cxf.phase.PhaseInterceptorChain
> >> >> > doIntercept ADVERTENCIA: Interceptor has thrown exception,
> >> >> > unwinding
> >> >> > now
> >> >> > org.apache.cxf.interceptor.Fault: Response was of unexpected
> >> >> > text/html
> >> >> > ContentType.  Incoming portion of HTML stream: <html>
> >> >> > <head>
> >> >> > <script>
> >> >> >        if ((typeof(opener.originalCookies) != "undefined")
> >> >> > &&
> >> >> > (opener.originalCookies != null))
> >> >> >        {
> >> >> >                var values, i;
> >> >> > etc, etc...
> >> >> > 
> >> >> > at
> >> >> > org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(S
> >> >> > taxInI
> >> >> > nterc eptor.java:73) at
> >> >> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(Phase
> >> >> > Interc
> >> >> > eptor Chain.java:236) at
> >> >> > org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java
> >> >> > :658)
> >> >> > at
> >> >> > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStrea
> >> >> > m.hand
> >> >> > leRes ponseInternal(HTTPConduit.java:2139) at
> >> >> > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStrea
> >> >> > m.hand
> >> >> > leRes ponse(HTTPConduit.java:2022) at
> >> >> > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStrea
> >> >> > m.clos
> >> >> > e(HTT PConduit.java:1947) at
> >> >> > org.apache.cxf.transport.AbstractConduit.close(AbstractCondu
> >> >> > it.jav
> >> >> > a:66) at
> >> >> > org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.
> >> >> > java:6
> >> >> > 32)
> >> >> > at
> >> >> > org.apache.cxf.interceptor.MessageSenderInterceptor$MessageS
> >> >> > enderE
> >> >> > nding
> >> >> > Interceptor.handleMessage(MessageSenderInterceptor.java:62)
> >> >> > at
> >> >> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(Phase
> >> >> > Inter
> >> >> > ceptor Chain.java:236) at
> >> >> > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:47
> >> >> > 2) at
> >> >> > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:30
> >> >> > 2) at
> >> >> > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:25
> >> >> > 4) at
> >> >> > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.j
> >> >> > ava:73
> >> >> > ) at
> >> >> > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProx
> >> >> > y.java
> >> >> > 
> >> >> > :123) at $Proxy49.execute(Unknown Source)
> >> >> > 
> >> >> >        at
> >> >> > com.garbora.btconnector.Starter.main(Starter.java:59)
> >> >> > javax.xml.ws.soap.SOAPFaultException: Response was of
> >> >> > unexpected
> >> >> > text/html ContentType.  Incoming portion of HTML stream:
> >> >> > <html>
> >> >> > 
> >> >> > 
> >> >> > Some ideas ?
> >> >> > 
> >> >> > thanks !!
> >> >> > JP
> >> > 
> >> > --
> >> > Daniel Kulp
> >> > dkulp@apache.org
> >> > http://dankulp.com/blog
> >> > Talend - http://www.talend.com
> > 
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://dankulp.com/blog
> > Talend - http://www.talend.com
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Mime
View raw message