当前位置: 首页 > 工具软件 > wsdl2ksoap > 使用案例 >

安卓序列化和java序列化_java – 在android中的Ksoap2无法序列化

颜祖鹤
2023-12-01

我在android中使用kso??ap2

将数字列表作为字符串发送

但它有错误:

java.lang.runtimeexception无法序列化

我搜索此错误的解决方案但结果没有改变

可以帮帮我

public String Send(ArrayList contactlist)

{

try{

SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);

PropertyInfo pi=new PropertyInfo();

pi.setType(String.class);

pi.setName("contactlist");

pi.setValue(contactlist);

request.addProperty("contactlist", pi);

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();

StrictMode.setThreadPolicy(policy);

// Creating SOAP envelope

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

new MarshalBase64().register(envelope); // this line is for serialization

//You can comment that line if your web service is not .NET one.

envelope.dotNet = true;

envelope.setOutputSoapObject(request);

AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport("http://10.0.2.2:54869/Service1.asmx");

androidHttpTransport.debug = true;

}

catch (Exception exception)

{

return exception.toString();

}

try

{

androidHttpTransport.call(SOAP_ACTION, envelope);

//String result = envelope.getResponse().toString();

return "";//result;

}

catch (Exception exception)

{

return exception.toString();

}

 类似资料: