i am doing Webservice using JAX-WS technology .
client - jaxws one (exposed to client with WSDL ) and - calls 2nd service implemented in JAX-WS which has authentication

communication between client - jaxws one (exposed to client with WSDL ) is OK .

communication between jaxws one (exposed to client with WSDL ) and - calls 2nd service - exception occured due to authentication

javax.xml.ws.WebServiceException Response: '401: Unauthorized' for url: 'http://host/HelloService'
at com.sun.xml.ws.wsdl.WSDLContext.<init>(WSDLContext.java:68)
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:207)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:165)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:49)
at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:18)

Tomcat means i do have solution ,infact for weblogic i didnt try even now as it is not in priyority list .

Thanks, Ganesh Gowtham
http://ganesh.gowtham.googlepages.com

Amit A Rathore

Greenhorn

Posts: 5

posted 8 years ago

Let me explain what I have done.

I have 2 make 2 webservice calls. 1 set of webservices are running under axis2 1.1 which are not secured and 2nd set of webservices are running under weblogic which are secured using basic HTTP authentication. Both these services are deployed in Weblogic 9.1.

My client program makes a call to webservices running in axis2 which inturn invokes webservices running in weblogic webservices and pass authentication details to this services using Authenticator class.

This was working fine when my axis2 was deployed under tomcat, the issue occured when I moved Axis2 to weblogic container.

Does that help you to understand the problem.

STACK TRACE:
weblogic.webservice.wsdl.WSDLParseException: Failed to retrieve WSDL from http://myserver:9001/myws/snwebservice?WSDL. Please check the URL and make sure that it is a valid XML file [java.io.FileNotFoundException: Response: '401: Unauthorized' for url: 'http://myserver:9001/myws/snwebservice?WSDL']
at weblogic.webservice.wsdl.DefinitionFactory.createDefinition(DefinitionFactory.java:160)
at weblogic.webservice.wsdl.WSDLParser.<init>(WSDLParser.java:50)
at weblogic.webservice.WebServiceFactory.createFromWSDL(WebServiceFactory.java:109)
at weblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:94)

infact i faced the same problem ... since tomcat --> weblogic migration is not priority it stopped working on this .

can uyou try this

Thanks, Ganesh Gowtham
http://ganesh.gowtham.googlepages.com

Amit A Rathore

Greenhorn

Posts: 5

posted 8 years ago

Ganesh,
Here is my code snippet:

// BasicHTTPAuthenticator is a subclass of java.net.Authenticator
Authenticator.setDefault(new BasicHTTPAuthenticator("myuser", "mypassword"));

// instantiate the endpoint impl. This Impl file is autogenerated as result of Weblogic ServiceGen
SupernovaWebServiceEndpoint_Impl ws = new SupernovaWebServiceEndpoint_Impl("http://myserver:9001/myws/snwebservice?WSDL");

Did you solution for this issue , if so could you please let us know the procedure you had followed .

Amit Rathore wrote:Ganesh,
Here is my code snippet:

// BasicHTTPAuthenticator is a subclass of java.net.Authenticator
Authenticator.setDefault(new BasicHTTPAuthenticator("myuser", "mypassword"));

// instantiate the endpoint impl. This Impl file is autogenerated as result of Weblogic ServiceGen
SupernovaWebServiceEndpoint_Impl ws = new SupernovaWebServiceEndpoint_Impl("http://myserver:9001/myws/snwebservice?WSDL");

For those who may stumble on this trying to find the answer this is what I did to get it to work.

Note that I think is is not a particularly elegant solution. I think that it would be much better to be using an Authenticator or a SOAPHandler however in Weblogic 10.3.2 (and from others who have posted similar questions on the web also in previous versions of weblogic) neither of these methods appears to work.

Its also worth noting that in order to get this to work either the url to get the wsdl needs to be unsecured or you need a local copy of the wsdl and to change the static initialiser of the gererated service class