Amit A Rathore

Greenhorn
+ Follow
since Jun 10, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Amit A Rathore

Hi Ganesh,
No luck yet. I had kept this at the back burner. I have raised this issue in other forums as well but no luck yet.

If you get something, do let me know.

--
Cheers
Amit
14 years ago
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.
14 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");

// get the endPointPort
SupernovaWebServiceEndpointPort port = (SupernovaWebServiceEndpointPort) ws.getSupernovaWebServiceEndpointPort();

So in this code where will I add your suggested code. I thought setting Authenticator before invocation should've handled it and it does it successfully when it runs under tomcat.

--
Cheers
ASR
14 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)
14 years ago
Hi Ganesh,
Did you find a solution to this problem? Even I am facing the same problem and have wasted 3 days without success. If you have solved it, can you please write your solution here....

--
Cherio
ASR
14 years ago