Web services 通过代理连接到AXIS 1.4 Webservice

Web services 通过代理连接到AXIS 1.4 Webservice,web-services,axis,webservices-client,Web Services,Axis,Webservices Client,我正在使用Axis1.4为我的Web服务生成Sub。这一代运行得很好,但我面临着通过WebProxy连接到webservice的问题 我使用axistools maven插件生成axis类 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>axistools-maven-plugin</artifactId> <version>1.4</versi

我正在使用Axis1.4为我的Web服务生成Sub。这一代运行得很好,但我面临着通过WebProxy连接到webservice的问题

我使用axistools maven插件生成axis类

   <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
 <urls>
  <url>http://mywiki/rpc/soap-axis/confluenceservice-v1?wsdl</url>
 </urls>

 <outputDirectory>${project.build.directory}/generated-wsdl-sources</outputDirectory>
 <packageSpace>de.allianz.wsdl.confluence</packageSpace>
 <testCases>false</testCases>
 <serverSide>false</serverSide>
 <subPackageByFileName>false</subPackageByFileName>
</configuration>
<executions>
 <execution>
  <id>add wsdl source</id>
  <phase>generate-sources</phase>
  <goals>
   <goal>wsdl2java</goal>
  </goals>
 </execution>
</executions>
<dependencies>
 <dependency>
  <groupId>axis</groupId>
  <artifactId>axis</artifactId>
  <version>1.4</version>
 </dependency>
</dependencies>
有没有办法告诉axis生成源以通过代理进行连接?(我已经阅读了如何在生成源时指定代理(以访问WSDL),但这不是我需要的-我需要通过代理连接到最终的Web服务)

我已经尝试了以下操作:
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;
 }
private ConfluenceSoapService createConfluenceSoapService()
抛出ServiceException{
ConfluenceSoapServiceLocator csssl=新ConfluenceSoapServiceLocator();
ConfluenceSoapService ConfluenceSoapService;
if(confluenceserviceAddress==null){
confluenceSoapService=csssl.getConfluenceserviceV1();
}否则{
URL端点;
试一试{
//端点=新URL(confluenceserviceAddress);
端点=新URL(“http”、代理主机、代理端口、confluenceserviceAddress);
}catch(java.net.MalformedURLException){
抛出新的javax.xml.rpc.ServiceException(e);
}
confluenceSoapService=csssl.getConfluenceserviceV1(端点);
}
ConfluenceserviceV1SoapBindingStub=(ConfluenceserviceV1SoapBindingStub)confluenceSoapService;
stub.setTimeout(超时);
返回confluenceSoapService;
}
并使用代理将端点更改为URL-但这会在运行时导致以下问题(即使代理设置已正确设置为URL对象)。如果在不使用代理的情况下使用URL对象,则会出现错误。
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)
java.net.MalformedURLException:对于输入字符串:“8080http:”
位于org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
位于org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
访问org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
访问org.apache.axis.SimpleChain.dovising(SimpleChain.java:118)
位于org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
位于org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
位于org.apache.axis.client.Call.invokeEngine(Call.java:2784)
位于org.apache.axis.client.Call.invoke(Call.java:2767)
我的问题: -我错过什么了吗? -是否有方法告诉axis生成源以使用web代理(通过web代理访问)


非常感谢您的帮助!如果您需要更多/其他信息来帮助,请告诉我。

试试这个,在我的情况下,使用System.setProperty为VM设置值不是一个好主意。使用AxisProperties将仅为特定连接设置值。我使用的是AXIS 1.4客户端

AxisProperties.getProperties().put("proxySet","true");

    AxisProperties.setProperty("http.proxyHost", PROXY_HOST); 
    AxisProperties.setProperty("http.proxyPort", PROXY_PORT); 

这不是设置了全局AxisProperties吗?如果您有其他webservice调用,这将与这些调用交互
AxisProperties.getProperties().put("proxySet","true");

    AxisProperties.setProperty("http.proxyHost", PROXY_HOST); 
    AxisProperties.setProperty("http.proxyPort", PROXY_PORT);