2013-06-22 151 views
0

我試圖打電話SPAL基於.NET Web服務在我的黑莓應用程序的PhoneGap和得到錯誤「服務器無法處理請求。--- >缺少根元素

這是我的代碼。

 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. ---&gt; Root element is missing.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope> 

任何人可以幫助我嗎? 我是個太過擔心

回答

0

更換所有線路

SoapMessageInXML = +'...'; 

SoapMessageInXML += '...'; 
+0

道歉,那是錯誤的。 但仍然錯誤是相同的 –

0

正如你XML封裝內的SOAP消息應該頂蓋元件沒有像這個?

<?xml version="1.0"?> 
<soap:Envelope 
xmlns:soap="http://www.w3.org/2001/12/soap-envelope" 
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> 
相關問題