我正在使用 ksoap 连接到 Android 上的 CrmDiscoveryService,问题来了:
SoapFault - 故障代码:'soap:server' faultstring:'服务器无法处理请求。' faultactor:'null' 详细信息:org.kxml2.kdom.Node@4061bd00
//here is namespace,endpoint,soapaction and methodname
public final static String DISCOVERY_NAMESPACE = "http://schemas.microsoft.com/crm/2007/CrmDiscoveryService/";
public final static String DISCOVERY_ENDPOINT_URL = "https://dev.crm5.dynamics.com/MSCRMServices/2007/Passport/CrmDiscoveryService.asmx";
public final static String SOAPACTION = "http://schemas.microsoft.com/crm/2007/CrmDiscoveryService/Execute";
private String MethodName = "Execute";
//below is the code connectting to crmdiscoveryservice
SoapObject rpc = new SoapObject(DISCOVERY_NAMESPACE, MethodName);
RetrievePolicyRequest retrievePolicyRequest = new RetrievePolicyRequest();
PropertyInfo info = new PropertyInfo();
info.name = "parameters";
info.type = retrievePolicyRequest.getClass();
info.setValue(retrievePolicyRequest);
rpc.addProperty(info);
HttpTransportSE ht = new HttpTransportSE(DISCOVERY_ENDPOINT_URL);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.encodingStyle = "utf-8";
envelope.setOutputSoapObject(rpc);
try {
ht.call(SOAPACTION, envelope);
if (envelope.getResponse() != null) {
SoapPrimitive response = (SoapPrimitive) envelope.bodyIn;
Log.e(tag, response.toString());
}
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
我自己定义了 RetrievePolicyRequest。试了很多次,还是有这个问题,有大神知道怎么解决吗?
谢谢!