0
private static final String NAMESPACE = "http://tempuri.org/" ;
private static final String URL = "http://mydomain.com/test.asmx";
private static final String PingSA = "http://tempuri.org/Ping";
private static final String PingMN = "Ping";
SoapObject request = new SoapObject(NAMESPACE, PingMN);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(PingSA, envelope);
Object x = envelope.getResponse();
}
catch(Exception e)
{
}
錯誤:的SOAPFault - Fault代碼: 'SOAP:服務器' faultstring:「System.Web.Services.Protocols.SoapException:服務器無法處理請求。 ---> System.InvalidOperationException:輸入消息不符合Simple SOAP Binding Profile Version 1.0。要求R1012:消息必須使用UTF-8或UTF-16字符編碼序列化信封。連接Android應用到.NET的.asmx
我嘗試(和沒有工作):
androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");