如何为“POST”方法进行服务调用?

时间:2016-12-01 17:29:57

标签: javascript jquery

如何使用下面描述的标题为有效负载执行“POST”方法的服务调用?

服务的有效负载:

{
  "SupplierPOPrint": {
    "ErrorFlag": "Status Code: 20, Message ID: 505",
    "ResultMessage": "Integration Service: Unable to find a routing corresponding to the incoming request message."
  }
}


headers: { "Accept": "application/json", "Content-Type": "text/xml", },

function poPrint() {
  $.ajax({
    url: '/wps/proxy/http/10.249.114.31:8009/soa-infra/resources/Supp‌​lierPortal/CreateSup‌​plierPOPrintService!‌​1.0/CreateSupplierPO‌​PrintService/Create'‌​,
    type: 'POST',
    dataType: 'json',
    data: new XMLSerializer().serializeToString(updatedTemplate),
    crossDomain: true,
    success: function(poPrintData) {
      console.log("poPrintData", poPrintData);
      poPrintDetails = poPrintData.SupplierPOPrint;
      console.log("poPrintDetails", poPrintDetails);
      poPrintTemplate = generatepoPrint(poPrintData);
      $("#poPrintOutput").html(poPrintTemplate);
    },
    error: function(data) {
      console.log("Update Content Failed", data);
    }
  });
}

0 个答案:

没有答案