5/7 更新:网络问题。。。端口不通,然后换了另一个内网。。。
对方有一个测试库和一个正式库,ip地址不一样,用的是同一个wsdl文件(不知道会不会有问题,但对方说是同一个wsdl文件)。对方的正式库也有别人在调用,应该不会有问题。
wsdl文件里下面的ip地址与测试库或正式库的ip都不一样。
<wsdl:service name="XXXService"> <wsdl:port binding="tns:XXXServiceServiceSoapBinding" name="XXXServiceSOAP"> <soap:address location="http://xxx.xxx.xx.xx:8088/ws/XXXService"/> </wsdl:port> </wsdl:service>
测试库的ip无法ping通,但是webservice调用成功。
正式库可以ping通,但是webservice调用出现异常,connect time out.
测试库的wsdl在浏览器访问提示有错:
This page contains the following errors:
error on line 1 at column 1: Document is empty
Below is a rendering of the page up to the first error.
而正式库的wsdl文件在浏览器里打不开。
对方说是做了处理,不让其他的人访问,所以我们要调用就给了一个wsdl文件。
客户端是直接在eclipse里通过wsdl文件生成的。调用方法如下:
String endpoint = "XXXService"; XXXServiceProxy proxy = new XXXServiceProxy(endpoint); try{ String result = proxy.request(); System.out.println(result); }catch(RemoteException e){ e.printStackTrace(); }
测试库和正式库只有endpoint里webservice地址的ip不同。
异常如下:
---------------------------------------------------------------------
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.ConnectException: Connection timed out: connect
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
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)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)