How to consume hotel.de API with ruby
Recently I had to access the xml webservice of hotel.de which caused a lot of headache due to a very few documentation docs.
So first of all it was hard to find a documentation about the service itself. Here it is.
http://www.hotel.de/media/downloads_public/hotelde_FreeHotelSearchWebService_V2_8.pdf
In order to the the spec of the service you might wanna take a look at a wsdl viewer:
Since I did not want to come up with a self written api consumer it decided to to ahead by using the savon gem (Version 2) http://savonrb.com/ .
Here is my constructor to get the client running
@client = Savon.client(
wsdl: "http://publicbetawebservices.hotel.de/V2_8/FreeHotelSearchWebService_ServiceContract.wsdl",
endpoint: "http://publicbetawebservices.hotel.de/V2_8/FreeHotelSearchWebService.svc?WSDL",
namespace_identifier: :v2,
env_namespace: :soapenv,
pretty_print_xml: true ,
log_level: :debug ,
log: true,
)
@client.operations
will give you an overview of the available methods.
since the child elements in the soap envelope body do not inherit the namespace identifier you might want to use nil
namespace_identifier: nil
Written by dcdieci
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#