jquery
2013-05-03 79 views 1 likes 
1

這是我的代碼:415不支持的媒體類型的jQuery

var myGTP = {}; 
var urlGTP = "http://gtpmain.wdf.xxxx.com:1080/sap/bc/srt/rfc/qte/rfc_read_struc_nodes/001/qte_rfc_read_struc_nodes/binding"; 

var soapMsg = 'var body = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/>' + 
    '<soapenv:Header/> <soapenv:Body> <urn:_-qte_-rfcReadStrucNodes>' + 
    '<IvLanguage>E</IvLanguage>' + 
    '<IvStructureId>' + structureId + '</IvStructureId>' + 
    '</urn:_-qte_-rfcReadStrucNodes> </soapenv:Body></soapenv:Envelope>'; 

$.ajax({ 
    url : urlGTP, 
    dataType : 'jsonp', 
    type : 'GET', 
    async : false, 
    data : soapMsg, 
    contentType : 'text/xml; charset=UTF-8', 
    username : "myuser", 
    passowrd : "mypassword", 
    success : function(data) { 
     myGTP = data; 
     console.log(data); 
    }, 
    error : function() { 
     alert("Error!"); 
    } 
}); 

而且我得到了錯誤415(不支持的媒體類型)。我試圖計算幾個小時,但我不知道是什麼問題。請幫忙!

回答

0
  1. 415錯誤意味着服務器錯誤。無論出於何種原因,它都不喜歡你的要求。
  2. 你爲什麼想要製作自己的SOAP信封?快速谷歌搜索「jQuery肥皂」返回this SOAP plugin。除非你正在製作一個圖書館,或者有特定的需要來自己做,這是不值得的。
  3. 在您的SOAP消息中包含var body = "是否有原因?
  4. 您的雙引號被打破。您有var body = "<soapenv,但不要關閉此報價。同一行是xmlns:soapenv=\"http,另一個引號不關閉。

但最終,我建議使用第三方SOAP庫的jQuery,而不是試圖推出自己的信封。

相關問題