0
votes

I am trying to create soap web service client by one client WSDL file by using Apache Axis 2 and tomcat 6.

I successfully generated client, but when I am calling methods to get data I am getting error.

WSDL location: https://staging2.myhcl.com/MedicalClaim/Service.svc?wsdl

Error:

Unable to sendViaPost to url[http://staging2.myhcl.com/MedicalClaim/Service.svc] java.net.SocketTimeoutException: Read timed out

My doubt is mentioned below:

  1. We are sending request with GET or POST methods that how we can know in SOAP web service?
  2. When above mentioned error used to come?
  3. Rather than Apache Axis 2, what other generating client can we use for this WSDL file?
1

1 Answers

0
votes

You might need to check how much time it is taking at Skeleton end.I have done SOAP some time back and i have faced same issue.Below code might help you

private HttpURLConnection getConnection(String endPoint) {
    try {
        URL url = new URL(endPoint);
        URLConnection connection = url.openConnection();
        connection.setConnectTimeout(20000); // 20 sec connection timeout
        connection.setReadTimeout(60000); // 60 sec read timeout
        HttpURLConnection httpConnection = (HttpURLConnection) connection;
        httpConnection.setRequestMethod("POST");
        OutputStream out = httpConnection.getOutputStream();
        return httpConnection;
    } catch (MalformedURLException e) {
        e.printStackTrace();
        return null;
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }

}

But ensure that your service(Skeleton) is not taking much time to process the request.You can use SoapUI to find out how much time it is taking to return the response.Accordingly you can set the timeout value.

Here comes answers of your doubts:

1.You can set POST/GET in HttpURLConnection object.

2.The error specified can come if the connection is idle for long and the Service is not returning any result.Use SoapUI to check the reply from Service.

3.wsdl2java and java2wsdl with Apache Axis2 is a good option for this purpose.Also xmlbeans has an inbuilt converter, which is quite handy to use.