2

我正在尝试与 BankId 集成(这是瑞典常见的身份验证和签名服务)。我正在使用 Savon Ruby SOAP 客户端并尝试按照他们的指南向 BankId 的测试 API 发出请求。调用“身份验证”操作时,出现以下错误:

The given SOAPAction Authenticate does not match an operation

SOAP 请求如下所示:

SOAP request: https://appapi.test.bankid.com/rp/v4
SOAPAction: "Authenticate", Content-Type: text/xml;charset=UTF-8, Content-Length: 384
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rp="http://bankid.com/RpService/v4.0.0/types/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <rp:AuthenticateRequest>
       <personalNumber>12345678</personalNumber>
     </rp:AuthenticateRequest>
  </env:Body>
</env:Envelope>

我正在使用以下详细信息创建会话:

这是代码:

> client = Savon.client(wsdl: 'https://appapi.test.bankid.com/rp/v4?wsdl', namespace: 'http://bankid.com/RpService/v4.0.0/types/', endpoint: 'https://appapi.test.bankid.com/rp/v4', ssl_cert_file: "XXXX/cert.pem", ssl_cert_key_file: "XXX/key.pem", ssl_cert_key_password: "qwerty123", pretty_print_xml: true, log_level: :debug, log: true)

> client.call(:authenticate, message: {personalNumber: '12345678'})

我应该提一下,我对使用 SOAP API 不是很熟悉。

4

1 回答 1

2

我只需要明确说明不需要soap_action 标头。

> client = Savon.client(wsdl: 'https://appapi.test.bankid.com/rp/v4?wsdl', namespace: 'http://bankid.com/RpService/v4.0.0/types/', endpoint: 'https://appapi.test.bankid.com/rp/v4', ssl_cert_file: "XXXX/cert.pem", ssl_cert_key_file: "XXX/key.pem", ssl_cert_key_password: "qwerty123", pretty_print_xml: true, log_level: :debug, log: true)

> client.call(:authenticate, message: {personalNumber: '12345678'}, soap_action: '')
于 2016-02-16T14:47:47.500 回答