Hi,
I have tried all the options mentioned for the CXF client on this thread
with username and password to invoke a CXF web service which is set up with
HTTP basic authentication. I am getting HTTP 401K status code. I am using
CXF 2.0 release version. Can someone shed light on this.
Thanks,
Durga
Axel Becker wrote:
>
> Hi Willem,
>
> it follows a log file snip that i created with the tomcat request dumper
> valve. nearly at the end you can see that the authType is null
>
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]: REQUEST URI
> =/GDHSService/services/INFOService
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> authType=null
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> characterEncoding=UTF-8
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> contentLength=-1
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> contentType=text/xml; charset=UTF-8
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> contextPath=/GDHSService
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> header=content-type=text/xml; charset=UTF-8
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> header=soapaction=""
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> header=cache-control=no-cache
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> header=pragma=no-cache
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> header=user-agent=Java/1.5.0_11
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> header=host=localhost:8080
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> header=accept=text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> header=connection=keep-alive
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> header=transfer-encoding=chunked
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> locale=de_DE
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> method=POST
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> pathInfo=/INFOService
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> protocol=HTTP/1.1
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> queryString=null
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> remoteAddr=127.0.0.1
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> remoteHost=127.0.0.1
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> remoteUser=null
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> requestedSessionId=null
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> scheme=http
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> serverName=localhost
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> serverPort=8080
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> servletPath=/services
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> isSecure=false
> 2007-07-25 19:19:54 RequestDumperValve[/GDHSService]:
> ---------------------------------------------------------------
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> ---------------------------------------------------------------
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> authType=null
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> contentLength=-1
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> contentType=text/xml;charset=utf-8
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> header=Content-Type=text/xml;charset=utf-8
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> header=Transfer-Encoding=chunked
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> header=Date=Wed, 25 Jul 2007 17:19:59 GMT
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> header=Server=Apache-Coyote/1.1
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> header=Connection=close
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> message=null
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> remoteUser=null
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> status=500
> 2007-07-25 19:19:59 RequestDumperValve[/GDHSService]:
> ===============================================================
>
> thanks for your help
> Axel
>
>
>
> Willem Jiang-2 wrote:
>>
>> Hi Axel,
>>
>> I checked the HTTPConduit code, your way to set the http basic
>> authentication is right.
>>
>> Can you use tcpmon to check the authentication informantion has been set
>> into the http headers?
>>
>> If not, I think it must be the CXF's bug.
>>
>>
>> Willem.
>>
>> Axel Becker wrote:
>>> Hi,
>>>
>>> i generated the client code with the wsdl2java from an existing wsdl.
>>>
>>> now i want to connect to this service (it is an axis 1 webservice). the
>>> service ist protected with a http basic authentication. i use the
>>> following
>>> code, but it doesnt work :-(
>>>
>>> INFOServiceService ss = new INFOServiceService(SERVICE_URL,
>>> SERVICE_NAME);
>>>
>>> Client client = ClientProxy.getClient(ss.getINFOService());
>>> HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
>>>
>>> httpConduit.getAuthorization().setUserName("username1");
>>> httpConduit.getProxyAuthorization().setUserName("username1");
>>>
>>> INFOService service = ss.getINFOService();
>>> //do somthing with service
>>>
>>> Where is the mistake?
>>>
>>> Thanks for your help!
>>> Axel
>>>
>>>
>>> PS: the serverside (axis1) code to get the auth parameter is:
>>> String username = MessageContext.getCurrentContext().getUsername();
>>>
>>>
>>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/HTTP-Basic-Auth-with-wsdl2java-generated-Client-tf4148070.html#a11957107
Sent from the cxf-user mailing list archive at Nabble.com.