与瑞典BankId集成时出现SOAP错误

时间:2016-02-16 09:39:07

标签: ruby soap savon bankid

我正在尝试与BankId集成(这是瑞典的常见身份验证和签名服务)。我正在使用Savon Ruby SOAP客户端并尝试在guidelines之后向BankId的测试API发出请求。在调用'authenticate'操作时,我收到以下错误:

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并不熟悉。

1 个答案:

答案 0 :(得分: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: '')