即使在socket timeout exception
中设置了时间,我也得到了Ksoap2
。
我曾经使用过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 在org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:130) 07-09 14:54:51.606 14047-14403 / com.erplogic.wms W / System.err:位于com.erplogic.Webservice.CreateCustomer.createCustomerAccount(CreateCustomer.java:43) 在com.erplogic.wms.UnloadTaskProcess $ MyTask.doInBackground(UnloadTaskProcess.java:61) 在android.os.AsyncTask $ 2.call(AsyncTask.java:304) 在java.util.concurrent.FutureTask.run(FutureTask.java:237) 在android.os.AsyncTask $ SerialExecutor $ 1.run(AsyncTask.java:243) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:607) 在java.lang.Thread.run(Thread.java:761)