title: Connect to AXIS 1.4 Webservice through a proxy
body: <p>I am using AXIS 1.4 to generate the subs for my webservice. The generation works fine as it is, but I am facing a problem to connect to the webservice though a WebProxy.</p>
  
  <p>I use the axistools-maven-plugin to generate my axis classes.</p>
  
  <pre><code>   &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://mywiki/rpc/soap-axis/confluenceservice-v1?wsdl&lt;/url&gt;
   &lt;/urls&gt;
  
   &lt;outputDirectory&gt;${project.build.directory}/generated-wsdl-sources&lt;/outputDirectory&gt;
   &lt;packageSpace&gt;de.allianz.wsdl.confluence&lt;/packageSpace&gt;
   &lt;testCases&gt;false&lt;/testCases&gt;
   &lt;serverSide&gt;false&lt;/serverSide&gt;
   &lt;subPackageByFileName&gt;false&lt;/subPackageByFileName&gt;
  &lt;/configuration&gt;
  &lt;executions&gt;
   &lt;execution&gt;
    &lt;id&gt;add wsdl source&lt;/id&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;dependencies&gt;
   &lt;dependency&gt;
    &lt;groupId&gt;axis&lt;/groupId&gt;
    &lt;artifactId&gt;axis&lt;/artifactId&gt;
    &lt;version&gt;1.4&lt;/version&gt;
   &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p></p>
  
  <p>If I use the following properties before the connect - everything works fine, but I set the properties VM wide which is not desirable:</p>
  
  <pre><code> public void setProxyHost(String proxyHost) {
    this.proxyHost = proxyHost;
    if(proxyHost != null){
     System.setProperty("http.proxyHost", proxyHost);
     AxisProperties.setProperty("http.proxyHost", proxyHost);  
  
    }  
   }
  
   public void setProxyPort(int proxyPort) {
    this.proxyPort = proxyPort;
    System.setProperty("http.proxyPort", ""+proxyPort);
    AxisProperties.setProperty("http.proxyPort", ""+proxyPort);  
   }</code></pre>
  
  <p>Is there any way to tell axis to generate sources to connect through a proxy? (I already read about how th specify a proxy when generating the sources (to access the WSDL) but this is not what I need - I need to connect to the final webservice through a proxy)</p>
  
  <p>I already tried to do the following:
  <pre><code>private ConfluenceSoapService createConfluenceSoapService()
     throws ServiceException {
    ConfluenceSoapServiceServiceLocator csssl = new ConfluenceSoapServiceServiceLocator();
    ConfluenceSoapService confluenceSoapService;
    if (confluenceserviceAddress == null) {
     confluenceSoapService = csssl.getConfluenceserviceV1();
    } else {
     URL endpoint;
     try {
      //endpoint = new URL(confluenceserviceAddress);
      endpoint = new URL("http",proxyHost,proxyPort,confluenceserviceAddress);
     } catch (java.net.MalformedURLException e) {
      throw new javax.xml.rpc.ServiceException(e);
     }
     confluenceSoapService = csssl.getConfluenceserviceV1(endpoint);
    }
    ConfluenceserviceV1SoapBindingStub stub = (ConfluenceserviceV1SoapBindingStub) confluenceSoapService;
    stub.setTimeout(timeout);
    return confluenceSoapService;
   }
  </pre></code>
  and change the endpoint to an URL using a proxy - but this leads to the following problem at runtime (even though the proxy settings are set correctly to the URL object. If I use the URL object without the proxy, I get to errors.
  <pre><code>java.net.MalformedURLException: For input string: "8080http:"
   at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
   at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
   at org.apache.axis.client.Call.invoke(Call.java:2767)
  </pre></code>
  <strong>My Questions:</strong>
  - Am I missing something? 
  - Is there a way to tell axis to generate the sources to work with a web proxy (to be accessed through a web proxy)</p>
  
  <p>Thanks a lot for your help! Please let me know if you need more/other information to help.</p>