SOAP fault when integrating with Swedish BankId

878 Views Asked by At

I'm trying to integrate with BankId (it's a common authentication and signing service in Sweden). I'm using Savon Ruby SOAP client and trying to make requests to the BankId's testing API following their guidelines. When making a call to an 'authenticate' operation, I am getting the following error:

The given SOAPAction Authenticate does not match an operation

The SOAP request looks as such:

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>

I'm creating a session using the following details:

Here's the code:

> 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'})

I should mention that I'm am not highly familiar with using SOAP API.

1

There are 1 best solutions below

1
On

I just needed to explicitly say that soap_action header was not required.

> 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: '')