Oliver Tupran
added a comment - 03/Mar/09 11:00 Actually there is also a problem on axis2-1.3. The problem manifested itself if the wsdl file was referencing or importing xsd files located on the same server specified through relative paths.
...
<wsdl:types>
<xsd:schema ...>
<xsd:import namespace="namespace" schemaLocation="../../some_schema.xsd"/>
...
</xsd:schema>
</wsdl:types>
...
As I see it, it looks like the authentication worked for the wsdl url, but not for the rest of the files.

Sbremal
added a comment - 24/Nov/09 13:07 Is this issue going to be fixed? Is there any workaround?
In enterprise environments it is quite common that the WSDL is stored at a password protected HTTP location. Would be good not to discurage people to use AXIS2 in business environments...
Can someone give a boost to the fix of this incident? Hotfix would also be fine...
Cheers,
Balazs

I was able to reproduce (read: I struggled with) this error, so I tested it with a quick-and-dirty PHP page to view what (if any) credentials were being passed. None were.

So, I looked into the source a bit to see what I could find.

I'm a little rusty on how java.net.URL is intended to work these days, but it seemed that the root of this issue lies in the wsdl4j-1.6.2 library, used by axis2, as it doesn't appear to subclass the Authenticator class anywhere. Specifically, the class com.ibm.wsdl.util.StringUtils and its method getContentAsInputStream(URL url) doesn't seem to be sending any authentication when it calls url.openStream()

I added an inner class within that class, and added one line to the getContentAsInputStream and was able to get access to the WSDL file using my credentials.
......
Here's my inner class...
.....

Mark Kinsella
added a comment - 14/Sep/10 01:47 I was able to reproduce (read: I struggled with) this error, so I tested it with a quick-and-dirty PHP page to view what (if any) credentials were being passed. None were.
So, I looked into the source a bit to see what I could find.
I'm a little rusty on how java.net.URL is intended to work these days, but it seemed that the root of this issue lies in the wsdl4j-1.6.2 library, used by axis2, as it doesn't appear to subclass the Authenticator class anywhere. Specifically, the class com.ibm.wsdl.util.StringUtils and its method getContentAsInputStream(URL url) doesn't seem to be sending any authentication when it calls url.openStream()
I added an inner class within that class, and added one line to the getContentAsInputStream and was able to get access to the WSDL file using my credentials.
......
Here's my inner class...
.....
static class WSDLAuthenticator extends Authenticator {
public PasswordAuthentication getPasswordAuthentication()
{
String[] userInfoParts = uri.getUserInfo().split(":");
return (new PasswordAuthentication(userInfoParts[0], userInfoParts[1].toCharArray()));
}
}
......
and I added this line after the if (url == null) block, to point the URL object to the Authenticator
......
Authenticator.setDefault(new WSDLAuthenticator());
.......
Not sure what the protocol is for suggesting patches to the wsdl4j project , but I suppose I'll cross my fingers that good karma will come my way if I try.
I believe the wsdl4j code is CPL'd.
Anyway, thought I'd post this in case anyone finds it useful, or wishes to critique my approach.

Is this problem solved? This is really required for the Enterprise services. We are also stuck with this issue. Trying to figure how I can bypass the live check of the schema. Looked into almost all of the code base and could not figure out where it is coming from.

axis2-wsdl2code-maven-plugin:1.4:wsdl2code (default) @ accessmanagerclient —
Retrieving document at 'src/main/resources/AMServices.wsdl'.
Retrieving schema at 'http://localhost:8001/am-services/AMServices?xsd=1', relative to 'file:/C:/ws/sso/accessmanagerclient/src/main/resources/AMServices.wsdl'.
java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8001/am-services/AMServices?xsd=1
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1290)
at java.net.URL.openStream(URL.java:1009)
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile(CodeGenerationEngine.java:288)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:111)
at org.apache.axis2.maven2.wsdl2code.WSDL2CodeMojo.execute(WSDL2CodeMojo.java:558)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 6.141s[INFO] Finished at: Thu Feb 02 10:53:34 PST 2012[INFO] Final Memory: 5M/9M[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal org.apache.axis2:axis2-wsdl2code-maven-plugin:1.4:wsdl2code (default) on project accessmanagerclient: Error parsing WSDL: WSDLException (at /definitions/types/xsd:schema[1]): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'http://localhost:8001/am-services/AMServices?xsd=1', relative to 'file:/C:/ws/sso/accessmanagerclient/src/main/resources/AMServices.wsdl'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8001/am-services/AMServices?xsd=1 -> [Help 1][ERROR][ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR][ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR][Help 1]http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

John D'costa
added a comment - 02/Feb/12 19:19 Is this problem solved? This is really required for the Enterprise services. We are also stuck with this issue. Trying to figure how I can bypass the live check of the schema. Looked into almost all of the code base and could not figure out where it is coming from.
axis2-wsdl2code-maven-plugin:1.4:wsdl2code (default) @ accessmanagerclient —
Retrieving document at 'src/main/resources/AMServices.wsdl'.
Retrieving schema at 'http://localhost:8001/am-services/AMServices?xsd=1', relative to 'file:/C:/ws/sso/accessmanagerclient/src/main/resources/AMServices.wsdl'.
java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8001/am-services/AMServices?xsd=1
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1290)
at java.net.URL.openStream(URL.java:1009)
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile(CodeGenerationEngine.java:288)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:111)
at org.apache.axis2.maven2.wsdl2code.WSDL2CodeMojo.execute(WSDL2CodeMojo.java:558)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.141s
[INFO] Finished at: Thu Feb 02 10:53:34 PST 2012
[INFO] Final Memory: 5M/9M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.axis2:axis2-wsdl2code-maven-plugin:1.4:wsdl2code (default) on project accessmanagerclient: Error parsing WSDL: WSDLException (at /definitions/types/xsd:schema [1] ): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'http://localhost:8001/am-services/AMServices?xsd=1', relative to 'file:/C:/ws/sso/accessmanagerclient/src/main/resources/AMServices.wsdl'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8001/am-services/AMServices?xsd=1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Sagara Gunathunga
added a comment - 13/Apr/12 13:36 I have fixed this issue on r1325736.
Now it's possible to use following two options.
-http-proxy-user <user name> Proxy user name for basic authentication if you are behind a firewall.
-http-proxy-password <password> Proxy password for basic authentication if you are behind a firewall.