Java: JAX-WS passing authentication info to a call to webservice

Posted by agnieszka on Stack Overflow See other posts from Stack Overflow or by agnieszka
Published on 2010-04-28T13:21:02Z Indexed on 2010/04/28 13:23 UTC
Read the original article Hit count: 368

Filed under:
|

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();

© Stack Overflow or respective owner

Related posts about java

Related posts about jax-ws