Retrieving WSDL file from secure service
Posted
by
Anonimo
on Stack Overflow
See other posts from Stack Overflow
or by Anonimo
Published on 2010-09-30T19:18:21Z
Indexed on
2010/12/23
13:54 UTC
Read the original article
Hit count: 457
I have a Web Service developed with JAX-WS. I have secured the web service with BASIC authentication configured in Tomcat.
When I try to access the web service using a Java client, I first need to create the port, and then specify the credentials, as follows:
CustomerServiceClient customerServiceClient = new CustomerServiceBottomUpService(); //1
CustomerService customer = customerServiceClient.getCustomerServicePort(); //2
Map<String, Object> context = ((BindingProvider) customer).getRequestContext(); //3
context.put(BindingProvider.USERNAME_PROPERTY, "kermit"); //4
context.put(BindingProvider.PASSWORD_PROPERTY, "thefrog"); //5
The problem I have is that, after line 1, I get an Authorization error (HTTP 401) as I obviously haven't provided the server with the credentials yet.
I am creating the client artifacts from a server WSDL, hence the authentication problem when creating the service, and don't want my clients to store the WSDL locally as it's just annoying for them. How can I get around this problem?
© Stack Overflow or respective owner