Hi,
I have been facing an issue for quite some time.
I have make 2 webservice calls, 1st call is to webservice running in Axis2 and deployed in Weblogic9.1 and the 2nd call is from the 1st webservice (running under axis2) to another webservice running under Weblogic9.1 and is using weblogic webservices. 2nd set of webservices are secured using basic http authentication.
Below is the code that accesses 2nd webservice and is written in 1st webservice implementation:
java.net.Authenticator.setDefault(new my.custom.authenticator.BasicHTTPAuthenticator("username", "password"));
MyAppWebServiceEndpoint_Impl ws = new MyAppWebServiceEndpoint_Impl("http://myserver:7001/myappws/snwebservice?WSDL");
MyAppWebServiceEndpointPort port = (MyAppWebServiceEndpointPort) ws.getMyAppWebServiceEndpointPort("username", "password");
Here,
MyAppWebServiceEndpoint_Impl and MyAppWebServiceEndpointPort is autogenerated by weblogic clientgen utility.
BasicHTTPAuthenticator is a custom authenticator which has just setters & getters and extends java.net.Authenticator.
Following the exception i am getting:
weblogic.webservice.wsdl.WSDLParseException: Failed to retrieve WSDL from
http://myserver:7001/myappws/snwebservice?WSDL. Please check the URL and make sure that it is a valid XML file java.io.IOException: Server returned HTTP response code: 401 for URL:
http://myserver:7001/myappws/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)
at com.mycompany.myapp.ws.client.MyAppWebServiceEndpoint_Impl.<init>(MyAppWebServiceEndpoint_Impl.java:22)
at Test.createServiceEndPoint(Test.java:72)
at Test.main(Test.java:21)
When i deploy axis2 in tomcat5.5, it works fine and when i move the while axis2 to weblogic it throws the above error.
Please provide some help.