Click here to Skip to main content
15,902,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello All I am Trying To Call A Web Service through my android application but it is Giving Java.net.sockettimeoutexception error please help me to resolve it

Thanks IN Advance
Here is the code snippnets


Java
final String SOAP_ACTION = "http://tempuri.org/Add";

      final String OPERATION_NAME = "Auth";

     final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";

      final String SOAP_ADDRESS = "http://citywebsofts.com/mysrv.asmx";
    //Property which holds input parameters

    SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
    PropertyInfo pi = new PropertyInfo();
    pi.setName("un");
    pi.setValue(R.id.editText);
    pi.setType(String.class);
    request.addProperty(pi);
    pi=new PropertyInfo();
    pi.setName("pass");
    pi.setValue(R.id.editText2);
    pi.setType(String.class);
    request.addProperty(pi);
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.dotNet = true;

    envelope.setOutputSoapObject(request);

    HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS,60000000);
    Object response=null;
    try
    {
        httpTransport.call(SOAP_ACTION, envelope);
        response = envelope.getResponse();
    }
    catch (Exception exception)
    {
        TextView tv= (TextView) findViewById(R.id.textView);

        response=exception.toString();
        tv.setText(response.toString());
    }
Posted
Updated 27-Sep-15 23:31pm
v2
Comments
Richard MacCutchan 28-Sep-15 7:03am    
Try connecting via webbrowser to see if it works.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900