繁体   English   中英

Java Web Service Client 访问.Net Webservice

[英]Java Web Service Client which access the .Net Webservice

我正在尝试通过 Java Webservice 客户端访问 online.Net Webservice。

但不幸的是,我收到一个错误“连接超时:连接

下面是我的代码:

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;

public class WebServiceMain {

    public static void main(String[] args) {

         try {
                 String endpoint = "http://wsf.cdyne.com/SpellChecker/check.asmx";
                 Service service = new Service();
                 Call call = (Call)service.createCall();
                 call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true)); 
                     call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://ws.cdyne.com/CheckTextBodyV2");
                     call.setTargetEndpointAddress( new java.net.URL(endpoint) );
                     call.setPortName(new QName("http://ws.cdyne.com/", "check"));
                 call.setOperationName(new QName("http://ws.cdyne.com/", "CheckTextBodyV2"));

                 System.out.println(call.invoke(new Object[] {"helo is my name"}));
               } catch (Exception e) {
                 System.err.println(e.toString());
               }
    }
}

Connection timeout comes because of network issues.try to acess URL in browser.also try to append?wsdl at the end of URL,you should see the wsdl.if this doesn't work troubleshoot network settings.

连接超时:连接

这意味着您的客户端应用程序甚至无法与 Web 服务通信。 这不是程序问题。

检查并查看您是否可以通过 web 浏览器访问端点。 如果不是,则该服务不可用。 所以它不起作用。

如果您的浏览器可以访问它,并且您通过代理连接到 Internet,那么您需要将代理详细信息指定给 Java 客户端。 为此,您可以在启动客户端应用程序时使用 -Dhttp.proxyHost=10.2.240.11 和 -Dhttp.proxyPort=8080(替换为您的值)系统属性。

下载soapui软件并安装它。 然后加载 wsdl 文件并创建项目。

然后通过 soap ui 测试您的 web 服务。 您可以编辑 soap ui 的连接超时值。 将其更改为大 vlue 和 test.still 您的 getiong 超时 ping 到服务的 ip 地址

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM