赛普拉斯发送 XML 请求(SOAP API)

时间:2021-01-04 08:31:36

标签: javascript api soap cypress

我试图将我的 XML 作为请求发送。它看起来像这样:

let requestBody = function (method){ 
return "<x:Envelope"
+"xmlns:x='someurl'"
+"xmlns:inf='someurl'>"
  +"<x:Header/>"
    +"<x:Body>"
        +"<inf:"+method+"></inf:"+method+">"
            +"</x:Body>"
               +"</x:Envelope>" }
"\n<x:Envelope"+


Cypress.Commands.add("getReports", (soapAction) => {
    var parseXML
    var action=requestBody(soapAction)
      cy.fixture('urlFixture').then((url)=>{
      cy.request({
        method: 'POST',
        url: url.indoDistV1,
        headers: {
            soapAction:url.actionStartAdress+soapAction,
            "ContentType":"text/xml; charset=utf-8"

        },
        body: requestBody(soapAction)
    })
})
})

响应是 415 有谁知道出了什么问题?

谢谢

1 个答案:

答案 0 :(得分:0)

我认为 "ContentType":"text/xml; charset=utf-8" 应该更改为 "Content-Type":"text/xml; charset=utf-8"