我正在尝试在我的 blackberry phonegap 应用程序中调用基于 spal 的 .net Web 服务并收到错误“服务器无法处理请求。---> 缺少根元素”
这是我的代码。
var SoapMessageInXML = '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
SoapMessageInXML +='<soap:Body>';
SoapMessageInXML +='<Login xmlns="http://tempuri.org/">';
SoapMessageInXML +='<aUserName>3007800000</aUserName>';
SoapMessageInXML +='<aPassword>27hitec0</aPassword>';
SoapMessageInXML +='<DeviceID>2</DeviceID>';
SoapMessageInXML +='</Login>';
SoapMessageInXML +='</soap:Body>';
SoapMessageInXML +='</soap:Envelope>';
$.ajax({
type: 'POST',
data: SoapMessageInXML,
contentType: "text/xml",
dataType: "text",
cache: false,
url: 'https://rippleapi.herokuapp.com/xhr_proxy?tinyhippos_apikey=ABC&tinyhippos_rurl=http://50.57.84.5/MobiTicker_mktService/MobileTicker.asmx?op=Login',
success: function (data) {
console.log(data);
},
error: function (xhr) {
console.log(xhr);
}
});
回应是
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to process request. ---> Root element is missing.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>
有人可以帮帮我吗?我太担心了