More than I like, I’ve run into situations where I had to post to services from ruby using WSDLs via SOAP requests. While there are some gems out there that help with it, writing your own solution is actually pretty straight forward.
In this post I will describe how you can use HAML to template your SOAP envelope for a WSDL request.
Lets say we are starting of with a WSDL request definition for retrieving snow board endorsers as described here. The WSDL request might look something like this:
HAML makes it easy to write that xml request a little simpler:
In a simple action we can then take that template, render it and pass it to a request:
Rendering HAML this way lets you pass in an object with params that can then be used to dynamically assign values in the template.
You can send this off to your endpoint and hopefully get some WSDL response back that you can then use to continue.
About the Author
BiographyMore Content by Georg Apitz