繁体   English   中英

415不支持的媒体类型jQuery

[英]415 Unsupported Media Type 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(不支持的媒体类型)。 我试了几个小时,但我不知道出了什么问题。 请帮忙!

  1. 415错误表示服务器错误。 无论出于什么原因,它都不喜欢您的请求。
  2. 您为什么要制作自己的SOAP信封? 快速的Google搜索“ jquery soap”返回此SOAP插件 除非您要创建一个库,或者有自己的特殊需要 ,否则这样做是不值得的。
  3. 是否有var body = "在SOAP消息中包含var body = "
  4. 您的双引号已损坏。 您有var body = "<soapenv ,但是永远不要关闭此引号。同一行是xmlns:soapenv=\\"http ,您不会关闭的另一引号。

但最终,我建议为jQuery使用第三方SOAP库,而不要尝试自己动手做信封。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM