Replicating Xml Request with Savon/Ruby

Converting raw XML query to Savon 2 Format

have you looked into the resulting XML message?

you should set the parameters

log => true,
log_level => :debug,
pretty_print_xml => true

and have a look.

Savon using built in request builder instead of raw xml

I usually do just this (untested). It's not pretty but it works.

credentials = { 'ns1:username' => 'user',
'ns1:password' => 'pwd!!',
'ns1:cultureInfo' => "it" }
response = client.call(:authenticate, message: credentials)

You might want to adapt the use of ns1 to the actually used namespace in your case.

Can't get Savon to form the right XML

Long story short, I had to make 3 changes.

  1. Changed response = client.request :language_count to
    response = client.request "LanguageCount"
  2. Added :xmlns => "http://tempuri.org/" to the end of the client.request call
  3. Explicitly called the SOAPaction like: client.http.headers["SOAPAction"] = '"http://tempuri.org/FooService/LanguageCount"'

Hope this helps someone as I've been in SOAP hell for the weekend and hopefully I'll stop someone else being there.



Related Topics



Leave a reply



Submit