即使在 Ksoap2 中设置时间,我也会收到 socket timeout exception . 我曾经使用SOAP Webservice . 使用基本认证用户名和密码 .

package com.erplogic.Webservice;

import android.util.Base64;
import android.util.Log;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;  
import java.io.IOException;

public class CreateCustomer {
String WSDL_URL = "http://infinitycosmic.com/ram/customer.wsdl";
String SOAP_ACTION = "http://sap.com/xi/A1S/Global/ManageCustomerIn/MaintainBundle_V1Request";
String NAME_SPACE = "http://sap.com/xi/A1S/Global";
String METHOD_NAME = "maintainBundleV1";

public void createCustomerAccount(){

    SoapObject soapObject = new SoapObject(NAME_SPACE,METHOD_NAME);
    soapObject.addProperty("InternalID","98765");
    soapObject.addProperty("CategoryCode","1");
    soapObject.addProperty("CustomerIndicator","true");
    soapObject.addProperty("LifeCycleStatusCode","2");

    PropertyInfo username = new PropertyInfo();
    username.setName("username");
    username.setValue("_ANDROIDPOC");
    soapObject.addProperty(username);

    PropertyInfo password = new PropertyInfo();
    password.setName("password ");
    password.setValue("Welcome1" );
    soapObject.addProperty(password );
    SoapSerializationEnvelope soapSerializationEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    soapSerializationEnvelope.setOutputSoapObject(soapObject);

    HttpTransportSE httpTransportSE = new HttpTransportSE(WSDL_URL,100*10000);
    try {
        httpTransportSE.call(SOAP_ACTION,soapSerializationEnvelope);

        SoapObject response = (SoapObject) soapSerializationEnvelope.bodyIn;
       String responses = response.getProperty(0).toString();

        Log.i("Response","************************   "+responses);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (XmlPullParserException e) {
        e.printStackTrace();
    }

}
}

错误日志如下:

07-09 14:54:51.605 14047-14403 / com.erplogic.wms W / System.err: java.net.SocketTimeoutException at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:130)07-09 14:54:51.606 14047 -14403 / com.erplogic.wms W / System.err:at com.erplogic.Webservice.CreateCustomer.createCustomerAccount(CreateCustomer.java:43)at com.erplogic.wms.UnloadTaskProcess $ MyTask.doInBackground(UnloadTaskProcess.java:61)在android.os.AsyncTask $ 2.call(AsyncTask.java:304)at java.util.concurrent.FutureTask.run(FutureTask.java:237)at android.os.AsyncTask $ SerialExecutor $ 1.run(AsyncTask.java:243) )java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:607)at java.lang.Thread.run(Thread.java: 761)