title: Connection refused - jaxws catalog in combination with jaxws-maven-plugin
body: <p>I'm trying to make my wsdl location not static anymore in my generated client (using the jaxws-maven-plugin), but I'm not having a lot of succes.</p>
  
  <p>What I've found is the following..</p>
  
  <p>My plugin (placed in the plugins in the build of the pom):</p>
  
  <pre><code>&lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;jaxws-maven-plugin&lt;/artifactId&gt;
  
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;ecad-ws&lt;/id&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;wsimport&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;sourceDestDir&gt;${basedir}/target/generated-sources&lt;/sourceDestDir&gt;
                          &lt;keep&gt;true&lt;/keep&gt;
                          &lt;verbose&gt;true&lt;/verbose&gt;
                          &lt;extension&gt;true&lt;/extension&gt;
                          &lt;wsdlDirectory&gt;src/main/resources&lt;/wsdlDirectory&gt;
                          &lt;wsdlFiles&gt;
                              &lt;wsdlFile&gt;CBS.wsdl&lt;/wsdlFile&gt;
                          &lt;/wsdlFiles&gt;
                          &lt;wsdlLocation&gt;http://localhost/wsdl/msw/cbs?wsdl&lt;/wsdlLocation&gt;
                          &lt;catalog&gt;
                              ${basedir}/src/main/resources/META-INF/jax-ws-catalog.xml
                          &lt;/catalog&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>and a jax-ws-catalog file (placed in src/main/resources/META-INF):</p>
  
  <pre><code>&lt;catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system"&gt;
  &lt;system
      systemId="http://localhost/wsdl/msw/cbs?wsdl"
      uri="../CBS.wsdl" /&gt;
  &lt;/catalog&gt;
  </code></pre>
  
  <p>the CBS.wsdl is placed in src/main/resouces. As far as I understand my research the above code changes the URL in the generated client to <a href="http://localhost/wsdl/msw/cbs?wsdl" rel="nofollow">http://localhost/wsdl/msw/cbs?wsdl</a> (that's working) and then, when the client is invoked, it looks for the catalog and matches the above url to ../CBS.wsdl. That last part isn't working since I'm getting the following exception:</p>
  
  <pre><code>Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
  at org.apache.cxf.wsdl11.WSDLServiceFactory.&lt;init&gt;(WSDLServiceFactory.java:94)
  at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)
  at org.apache.cxf.jaxws.ServiceImpl.&lt;init&gt;(ServiceImpl.java:148)
  ... 118 more
  Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR:   Problem parsing 'http://localhost/wsdl/msw/cbs?wsdl'.: java.net.ConnectException: Connection refused: connect
  at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
  at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
  at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
  at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:244)
  at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:191)
  at org.apache.cxf.wsdl11.WSDLServiceFactory.&lt;init&gt;(WSDLServiceFactory.java:92)
  ... 120 more
  Caused by: java.net.ConnectException: Connection refused: connect
  </code></pre>
  
  <p>I can't really find another solution. If I'm not changing the wsdl location in the generated client I'm always getting something like "Failed to access the WSDL at: file: XXXXX" (what is completely normal)</p>
  
  <p>I'm using the jdk 7 btw..</p>