title: Generate Client Web Service With Maven And Axis
body: <p>I have a problem when Maven is generating the source code for a client web service with Axis.  </p>
  
  <p>I need consume the wsdl from url exposed by other company. For example, this is the wsdl content in url <a href="http://127.0.0.1:8080/ESBService/Example?wsdl" rel="nofollow">http://127.0.0.1:8080/ESBService/Example?wsdl</a></p>
  
  <pre><code>&lt;wsdl:definitions xmlns:ns0="http://www.davivienda.com/xml/Example" xmlns:wsp200607="http://www.w3.org/2006/07/ws-policy" xmlns:wsp200409="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soap11="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.davivienda.com/xml/Example"&gt;
      &lt;wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
          &lt;xsd:schema&gt;
              &lt;xsd:import schemaLocation="MySchema.xsd1.xsd" namespace="http://www.davivienda.com/xml/Example"/&gt;
              &lt;xsd:import schemaLocation="MySchema.xsd2.xsd" namespace="http://www.davivienda.com/xml/Example"/&gt;
          &lt;/xsd:schema&gt;
      &lt;/wsdl:types&gt;
      &lt;wsdl:message name="Example_in"&gt;
          &lt;wsdl:part xmlns:xsns="http://www.davivienda.com/xml/Example" name="Example" element="xsns:Example"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="Example_out"&gt;
          &lt;wsdl:part xmlns:xsns="http://www.davivienda.com/xml/Example" name="ExampleResponse" element="xsns:ExampleResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:portType name="ExamplePortType"&gt;
          &lt;wsdl:operation name="Example"&gt;
              &lt;wsdl:input name="Example_Input" message="ns0:Example_in"/&gt;
              &lt;wsdl:output name="Example_Output" message="ns0:Example_out"/&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:portType&gt;
      &lt;wsdl:binding name="ExampleExampleSOAP_HTTP_Binding" type="ns0:ExamplePortType"&gt;
          &lt;soap11:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/&gt;
          &lt;wsdl:operation name="Example"&gt;
              &lt;soap11:operation soapAction="" style="document"/&gt;
              &lt;wsdl:input name="Example_Input"&gt;
                  &lt;soap11:body parts="Example" use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output name="Example_Output"&gt;
                  &lt;soap11:body parts="ExampleResponse" use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:binding&gt;
      &lt;wsdl:service name="ExampleExample_HTTP_Service"&gt;
          &lt;wsdl:port name="ExampleExample_HTTP_Port" binding="ns0:ExampleExampleSOAP_HTTP_Binding"&gt;
              &lt;soap11:address location="http://127.0.0.1:8080/ESBService/Example"/&gt;
          &lt;/wsdl:port&gt;
      &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>And this is my pom file:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.example.axis&lt;/groupId&gt;
      &lt;artifactId&gt;client&lt;/artifactId&gt;
      &lt;version&gt;0.0.1&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;client&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;org.codehaus.mojo&lt;/id&gt;
              &lt;name&gt;org.codehaus.mojo&lt;/name&gt;
              &lt;url&gt;http://repository.codehaus.org/&lt;/url&gt;
              &lt;layout&gt;default&lt;/layout&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.axis&lt;/groupId&gt;
              &lt;artifactId&gt;axis&lt;/artifactId&gt;
              &lt;version&gt;1.4&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.xml&lt;/groupId&gt;
              &lt;artifactId&gt;jaxrpc-api&lt;/artifactId&gt;
              &lt;version&gt;1.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.mail&lt;/groupId&gt;
              &lt;artifactId&gt;mail&lt;/artifactId&gt;
              &lt;version&gt;1.4.1&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.activation&lt;/groupId&gt;
              &lt;artifactId&gt;activation&lt;/artifactId&gt;
              &lt;version&gt;1.1&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.eclipse.m2e&lt;/groupId&gt;
                      &lt;artifactId&gt;lifecycle-mapping&lt;/artifactId&gt;
                      &lt;version&gt;1.0.0&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;lifecycleMappingMetadata&gt;
                              &lt;pluginExecutions&gt;
                                  &lt;pluginExecution&gt;
                                      &lt;pluginExecutionFilter&gt;
                                          &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                                          &lt;artifactId&gt;axistools-maven-plugin&lt;/artifactId&gt;
                                          &lt;versionRange&gt;[1.4,)&lt;/versionRange&gt;
                                          &lt;goals&gt;
                                              &lt;goal&gt;wsdl2java&lt;/goal&gt;
                                          &lt;/goals&gt;
                                      &lt;/pluginExecutionFilter&gt;
                                      &lt;action&gt;
                                          &lt;ignore /&gt;
                                      &lt;/action&gt;
                                  &lt;/pluginExecution&gt;
                              &lt;/pluginExecutions&gt;
                          &lt;/lifecycleMappingMetadata&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
          &lt;plugins&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;axistools-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.4&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;urls&gt;
                          &lt;url&gt;http://127.0.0.1:8080/ESBService/Example?wsdl&lt;/url&gt;
                      &lt;/urls&gt;
                      &lt;packageSpace&gt;com.example.axis.client&lt;/packageSpace&gt;
                      &lt;outputDirectory&gt;${project.build.directory}/generated-sources/wsdl2java&lt;/outputDirectory&gt;
                  &lt;/configuration&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;javax.mail&lt;/groupId&gt;
                          &lt;artifactId&gt;mail&lt;/artifactId&gt;
                          &lt;version&gt;1.4.1&lt;/version&gt;
                      &lt;/dependency&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;javax.activation&lt;/groupId&gt;
                          &lt;artifactId&gt;activation&lt;/artifactId&gt;
                          &lt;version&gt;1.1&lt;/version&gt;
                      &lt;/dependency&gt;
                  &lt;/dependencies&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;phase&gt;generate-sources&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;wsdl2java&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>When I execute Run As->-generated sources in eclipse, Axis plugin couldn't read the schema from url and throw the following error:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.codehaus.mojo:axistools-maven-plugin:1.4:wsdl2java (default) on project client: Error generating Java code from WSDL. Error running Axis: WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: An error occurred trying to resolve schema referenced at 'MySchema.xsd1.xsd', relative to 'file:/E:/IDE/sts-bundle/workspaces/java/hermes-webapplet/client/target/axistools/wsdl2java/urlDownloads/http---127.0.0.1-ESBService-Example-wsdl.wsdl'.: This file was not found: file:/E:/IDE/sts-bundle/workspaces/java/hermes-webapplet/client/target/axistools/wsdl2java/urlDownloads/MySchema.xsd1.xsd -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:axistools-maven-plugin:1.4:wsdl2java (default) on project client: Error generating Java code from WSDL.
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
  </code></pre>