Getting my feet wet

70 views
Skip to first unread message

Hameed Gifford

unread,
May 20, 2014, 4:38:03 PM5/20/14
to sav...@googlegroups.com
Hi all. I am getting into the API of a service that I use, and they implement SOAP, so I got Savon working on my machine and went to task learning this stuff.

Well, I've done this:

require 'savon'
client = Savon.client(wsdl: "WSDL_HYPERLINK")

and got all the operations, and went to call the login operation:

response = client.call(:login) do
message(loginId: "username", password: "password")
end

replacing the username and password with the correct fields, obviously.

However, I get this error:

Savon::SOAPFault: (env:Client) caught exception while handling request: unexpected encoding style: expected=http://schemas.xmlsoap.org/soap/encoding/, actual=
        from /var/lib/gems/2.0.0/gems/savon-2.5.1/lib/savon/response.rb:85:in `raise_soap_and_http_errors!'
        from /var/lib/gems/2.0.0/gems/savon-2.5.1/lib/savon/response.rb:14:in `initialize'
        from /var/lib/gems/2.0.0/gems/savon-2.5.1/lib/savon/operation.rb:64:in `new'
        from /var/lib/gems/2.0.0/gems/savon-2.5.1/lib/savon/operation.rb:64:in `create_response'
        from /var/lib/gems/2.0.0/gems/savon-2.5.1/lib/savon/operation.rb:55:in `call'
        from /var/lib/gems/2.0.0/gems/savon-2.5.1/lib/savon/client.rb:36:in `call'
        from (irb):44
        from /usr/bin/irb:12:in `<main>'

What's going on here? The documentation on my service's API site says that all errors are thrown as SOAP faults, but how do I read this?

Just as information, the service says that the login method has two parameters:
1) loginId of type string
2) password of type string

Am I entering the "parameters" in the incorrect way, i.e. should they not me a locals message?

Thanks.
- Hameed G.

Steffen Roller

unread,
May 20, 2014, 8:18:04 PM5/20/14
to sav...@googlegroups.com
Hi,

you should switch on logging with

log: true,
log_level: :debug,
pretty_print_xml: true

If that doesn't give you a clue then you should install SoapUI and try first to call your service sucessfully using that tool. In the next step you should then build your successful message using Savon.

-st


--
You received this message because you are subscribed to the Google Groups "Savon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to savonrb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hameed Gifford

unread,
May 20, 2014, 11:56:39 PM5/20/14
to sav...@googlegroups.com
The service is currently down, but thanks for leading me in those directions... I will definitely use SoapUI until I'm comfortable with this. There is very little learning material on any SOAP library out there.

- Hameed G.
Reply all
Reply to author
Forward
0 new messages