GAS中的SOAP请求失败

时间:2019-01-21 20:54:26

标签: soap google-apps-script soapui

调用SOAP API时,出现以下错误:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <s:Fault>
      <faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">
        a:ActionNotSupported
      </faultcode>
      <faultstring xml:lang="en-US">
        The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
      </faultstring>
    </s:Fault>
  </s:Body>
</s:Envelope>

我的代码在Google Apps脚本中,看起来像这样:

var apiAuthParams = {
  'method' : 'post',
  'contentType' : 'text/xml',
  'payload' : apiAuthSoapRequest,
  'muteHttpExceptions': true
};

var apiAuthResponse = UrlFetchApp.fetch(apiAuthUrl, apiAuthParams);

其中apiAuthUrl是请求URL(我已经三遍检查了它的正确性!),而apiAuthSoapRequest是请求URL。

如果我通过相同的目标URL通过SOAP UI发出完全相同的请求进行测试,那么它可以正常工作,所以我不明白通过GAS进行处理时有什么不同?我经常以这种方式进行SOAP调用,并且以前从未遇到过该问题。

0 个答案:

没有答案