Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic Server returned HTTP response code: 401 for URL  RSS feed

Amit A Rathore
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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: 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");

MyAppWebServiceEndpoint_Impl and MyAppWebServiceEndpointPort is autogenerated by weblogic clientgen utility.
BasicHTTPAuthenticator is a custom authenticator which has just setters & getters and extends

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 Server returned HTTP response code: 401 for URL: http://myserver:7001/myappws/snwebservice?WSDL
at weblogic.webservice.wsdl.DefinitionFactory.createDefinition(
at weblogic.webservice.wsdl.WSDLParser.<init>(
at weblogic.webservice.WebServiceFactory.createFromWSDL(
at weblogic.webservice.core.rpc.ServiceImpl.<init>(
at Test.createServiceEndPoint(
at Test.main(

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.
Chintan Rajyaguru
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not familiar with WebLogic but are you sure your client code is correct? Is the line ws.getMyAppWebServiceEndpointPort("username", "password"); allowed in WebLogic client? I am not aware of any method that takes username and password as arguments. May be it is WebLogic specific.

Look at the code 401 description here. Assuming your username and password are correct, try hitting the WSDL URL in a browser. You should be asked for username and password in a popup and see what happens.

Finally, do you have to set any proxy settings when you run from WebLogic?
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!