开发者

Java Web Service Client which access the .Net Webservice

I'm trying to access online .Net Webservice through Java Webservice client.

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/", "chec开发者_如何学Gok"));
                 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 timed out: connect

This means that your client application cannot even talk to the Web Service. This is not a programmatic issue.

Check and see whether you can access the end-point through your web browser. 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. 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.


Download the soapui software and get installed it. then load the wsdl file and create the project.

Then test your web service via soap ui. you can edit the connection timeout value of the soap ui. chane it for big vlue and test.still your getiong time out ping to the ip addres of the service

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜