Java: JAX-WS passing authentication info to a call to webservice
- by agnieszka
I am using JAX-WS. I am connecting to .NET webservice that requires authentication. I first call the Authentication.asmx so that I can be authenticated. The call returns me a LoginResult that contains a cookie name.
Then I call another webservice and I need to somehow pass this cookie or a cookie name. and I don't know how. Here is the code:
//first service that returns login information
Authentication auth = new Authentication(new URL("the_url"),
new QName("http://schemas.microsoft.com/sharepoint/soap/", "Authentication"));
LoginResult result = auth.getAuthenticationSoap().login(HTTPuserName,
HTTPpassword);
//i need to pass cookie or cookie name or any other login information to call to this service
Copy copyService = new Copy(new URL("service_url"), new QName("http://schemas.microsoft.com/sharepoint/soap/", "Copy"));
BindingProvider p = (BindingProvider) copyService.getCopySoap();