0

I am having a difficulty to find a solution to my problem. I will not able to figure out or find the real cause of the problem. Basically when I call a java web service I am having an error saying "invalid stream or encoding exception: java.net.SocketTimeoutException caused by : java.net.SocketTimeoutException"

Here is how I call the service:

try
{
    final String METHOD_NAME = "METHOD_NAME";
    final String SOAP_ACTION = "NAMESPACE" + METHOD_NAME;
    final String URL = HTTPURL;
    SoapObject request = new SoapObject("NAMESPACE", METHOD_NAME);
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.setOutputSoapObject(request);
    HttpTransportSE httpTransport = new HttpTransportSE(URL, (int) 10000);
    httpTransport.call(SOAP_ACTION, envelope);
    resultsObject = (SoapObject) envelope.bodyIn;
    httpTransport.getServiceConnection().disconnect();

    if (resultsObject != null) 
    {
        ServiceResult serviceResult = new ServiceResult();
        int propertyCount = resultsObject.getPropertyCount();
        if (propertyCount > 0) 
        {
            //PROCESS 
        }
    }
}
catch(Exception e)
{
    String mess = e.getMessage();
}

I appreciate any help.

  • Your primary problem here has nothing to do with soap, but with the network access. Your request times out. You need to fix that first. You can see this question for a nice explanation on where your connection problem is. http://stackoverflow.com/questions/7360520/connectiontimeout-versus-sockettimeout – thst Aug 29 '16 at 08:23
  • I have increased the timeout but I am getting another error which is "Invalid stream or encoding: java.net.SocketException: recvfrom failed: ECONNRESET " – user2500797 Aug 29 '16 at 09:37
  • If you have access to the server, check the server logs. The server fails and resets connection. This is still not a soap issue, you are not getting a response. – thst Aug 29 '16 at 09:43
  • This error can happen if your properties are not of the right format. Does the request and format given in wsdl match? – K Neeraj Lal Sep 04 '16 at 04:15

0 Answers0