SocketTimeoutException when using soap in android

159 views Asked by At

I used this code in AsyncTask for sending string to my web service.

    public String postData()
    { 
        String strRet = ""; 
        try {
            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 

            request.addProperty("val",dataField);

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                    SoapEnvelope.VER11);
            envelope.dotNet = true; 
            envelope.setOutputSoapObject(request); 
            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

            androidHttpTransport.call(SOAP_ACTION, envelope);
            //Get the response
            SoapPrimitive  response = (SoapPrimitive ) envelope.getResponse(); 
            strRet = response.toString();
        } catch (HttpResponseException e) { 
        } catch (XmlPullParserException e) {  
        } catch (SoapFault e) { 
        } catch (IOException e) { 
        } catch (Exception e) { 
        } 
        return strRet;
    }

my web service is asp.net(vb.net) my asmx code is simple same this:

  <WebMethod()> _
Public Function Save(ByVal val As String) As String
    Return "success";
End Function

when my string is small it's ok and work fine, but when my string length is big(for example 3000 char), it not work and return this exception in IOException

java.net.SocketTimeoutException

how i can fix this problem?

0

There are 0 answers