0

我需要将数据发布到我的后端系统 (SAP)。我正在尝试使用以下代码:

硬编码 URL 示例:

  var dataString = ""
    //Add TO SAP.
     var aData =  
            jQuery.ajax({
                type: "POST",
                //contentType: "application/xml",
                url: "http://delyo001.you.local:8000/sap/bc/youconsulting/ws/rest/anonymous/z_names_post?firstname=testz&lastname=zefzef",  // for different servers cross-domain restrictions need to be handled
                data: dataString,
                //dataType: "json"

                success: function(xml) { // callback called when data is received
                    //oModel.setData(data);             // fill the received data into the JSONModel
                    alert("success to post");
                },

                error: function(xml) { // callback called when data is received
                    //oModel.setData(data);             // fill the received data into the JSONModel
                    alert("fail to  post");
                    alert(xml);
                }
            });

该网络服务通过 SOAPUI 工作。但不是通过这种方式。

谁能指导一下这段代码有什么问题。

亲切的问候,文森特

4

1 回答 1

0

尝试将标题设置为:

标头:{“内容类型”:“应用程序/x-www-form-urlencoded”}

于 2012-11-30T09:57:47.493 回答