Thanks in advance for any help I get on this!
I'm trying to duplicate a SoapUI request using Savon 2.3.3 as below, but I cannot figure out a way to match the WSSE security attributes below:
The three issues I'm seeing are:
1. How do I add attribute 'soapenv:mustUnderstand="1" to wsse:Security?
2. How do I add EncodingType to wsse:Nonce?
3. How do I modify format of the wsu:Created timestamp?
Working in SoapUI:
<soapenv:Header>
<wsse:UsernameToken wsu:Id="UsernameToken-12">
<wsse:Username>userId</wsse:Username>
<wsu:Created>2014-01-02T23:36:41.12Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<acc:GetRequest>
<msg:MessageHeader>
<msg:SequenceNumber>1111</msg:SequenceNumber>
</msg:MessageHeader>
<acc:Payload>
<acc:Stuff>Stuff</acc:Stuff
</acc:Payload>
</acc:GetRequest>
</soapenv:Body>
</soapenv:Envelope>
Failing in Savon:
<soapenv:Header>
<wsse:Username>userId</wsse:Username>
<wsse:Nonce>22e70dfb2639fd23c0cdb85875c0ec530af00915</wsse:Nonce>
<wsu:Created>2014-02-03T15:00:34-06:00</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<acc:GetRequest>
<msg:MessageHeader>
<msg:SequenceNumber>1111</msg:SequenceNumber>
</msg:MessageHeader>
<acc:Payload>
<acc:Stuff>Stuff</acc:Stuff
</acc:Payload>
</acc:GetRequest>
</soapenv:Body>
</soapenv:Envelope>
Code:
require 'savon'
require 'httpi'
namespaces = {
}
client = Savon.client(
:wsse_auth => ['userId','password, :digest],
convert_request_keys_to: :none,
env_namespace: :soapenv,
namespaces: namespaces,
namespace_identifier: :acc
pretty_print_xml: true)
response = client.call(:get_accession, message: {
:"msg:MessageHeader" => {
"msg:SequenceNumber" => '1111',
},
:"acc:Payload" => {
"acc:Stuff" => 'Stuff'
}
})
Thank you!
Bonus points to how I can remove the duplicate headers created by Savon in blue, since I've defined namespaces myself.