Reputation: 811
The header in my SOAP doc needs to have an attribute like this:
<soap:Header>
<eWAYHeader xmlns="https://www.eway.com.au/gateway/managedpayment">
<eWAYCustomerID>string</eWAYCustomerID>
<Username>string</Username>
<Password>string</Password>
</eWAYHeader>
The eWAYHeader needs an xmlns attribute.
I've tried
def create_customer(customer, card)
response = @client.request(:create_customer, "xmlns" => "https://www.eway.com.au/gateway/managedpayment") do
soap.header = header
soap.body = create_customer_body(customer, card)
end
end
private
def header
{
"eWAYHeader" => {
:attributes! => { :xmlns => 'http://www.eway.com.au/gateway/managedpayment' },
"eWayCustomerID" => '87654321',
"Username" => '[email protected]',
"Password"=> 'test123'
}
}
end
but the attributes! entry is ignored.
soap.header will only accept a Hash as an argument so I can't just set it's value using a string.
How do I achieve this in Savon?
thanks,
Martin
Upvotes: 2
Views: 2242
Reputation: 81
You can achieve by doing this
soap.header = {
"eWAYHeader" => {
"eWayCustomerID" => '87654321',
"Username" => '[email protected]',
"Password"=> 'test123'
},
:attributes! => {"eWAYHeader" => { :xmlns => 'http://www.eway.com.au/gateway/managedpayment' } }, }
Upvotes: 5