简体   繁体   English

Java Web Service Client 访问.Net Webservice

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

I'm trying to access online.Net Webservice through Java Webservice client.我正在尝试通过 Java Webservice 客户端访问 online.Net Webservice。

But unfortunately, am getting an error " Connection timed out: connect "但不幸的是,我收到一个错误“连接超时:连接

Below is my code:下面是我的代码:

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. 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.

Connection timed out: connect连接超时:连接

This means that your client application cannot even talk to the Web Service.这意味着您的客户端应用程序甚至无法与 Web 服务通信。 This is not a programmatic issue.这不是程序问题。

Check and see whether you can access the end-point through your web browser.检查并查看您是否可以通过 web 浏览器访问端点。 If not, then that service is not available.如果不是,则该服务不可用。 So it doesn't work.所以它不起作用。

If your browser can access it, and if you are connecting to Internet through a proxy, then you need to specify the proxy details to Java Client.如果您的浏览器可以访问它,并且您通过代理连接到 Internet,那么您需要将代理详细信息指定给 Java 客户端。 To do that, you can use -Dhttp.proxyHost=10.2.240.11 and -Dhttp.proxyPort=8080 (replace with your values) system properties when you start up your client application.为此,您可以在启动客户端应用程序时使用 -Dhttp.proxyHost=10.2.240.11 和 -Dhttp.proxyPort=8080(替换为您的值)系统属性。

Download the soapui software and get installed it.下载soapui软件并安装它。 then load the wsdl file and create the project.然后加载 wsdl 文件并创建项目。

Then test your web service via soap ui.然后通过 soap ui 测试您的 web 服务。 you can edit the connection timeout value of the soap ui.您可以编辑 soap ui 的连接超时值。 chane it for big vlue and test.still your getiong time out ping to the ip addres of the service将其更改为大 vlue 和 test.still 您的 getiong 超时 ping 到服务的 ip 地址

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

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