views:

45

answers:

1

Hi. I'm trying to connect with a webservice that's in a password protected host, i.e. you must enter user+pass to access the remote WSDL.

The key word there is "trying", I have a client made by WSDL2JAVA that works ok if the service is unprotected, but I can't find how to add the login to that code.

To clarify, it's not the webservice who demands authentication, but the site itself. I'm testing with a secured realm in a tomcat server, but I'm lookin for a platform independent solution.

Has anybody been able to do this?

A: 

I've found a solution:

First create a HttpClient object and authenticate it, as explained here. Then without closing that connection, connect with the webservice as usual.

And that's it. I'm not sure why that works, I think that the java process saves the connection cookie or something like that.

romangoro