1

I'm using Savon Ruby gem to call a SOAP API, I have the request almost ready but one thing is bugging still.

savonclient = Savon.client(wsdl: 'test.wsdl',
endpoint: 'http://endpoint.biz/',
                  log: true,
                  log_level: :debug,
                  pretty_print_xml: true,
                  convert_request_keys_to: :none,
                  namespaces: { 'xmlns:buggy' => 'http://otherdomain.biz/something.xsd'},
                  soap_header: { 'buggy:client' => {
"id:property1" => 'value1',
"id:property2" => 'value2'
}

This produces

<env:Header>
<buggy:client>
  <id:property1>value1</id:property1>
  <id:propert2>value2</id:property2>
</buggy:client>

What I need is to have property after buggy:client, like this:

<buggy:client id:objecttype="something">

I tried adding attributes hash for the soap_header, but it only creates a new attribute below .

Any ideas?

bmes
  • 61
  • 2
  • 8
  • 2
    Try to add `attributes!: { "buggy:client" => { "id:objecttype" => "something" } }` into property hash is it is done [inside library](https://github.com/savonrb/savon/blob/fcb56fab6024ed2eb9c71e261d72a893a12abfbf/lib/savon/header.rb#L65). – Aleksei Matiushkin Nov 14 '17 at 14:36
  • Thanks, that did the trick! I didn't try adding attributes with "buggy:client". – bmes Nov 14 '17 at 15:02
  • Welcome. I always grep the codebase for examples, and it always helps. All that stuff is OSS after all. – Aleksei Matiushkin Nov 14 '17 at 15:06

0 Answers0