# SOAP client in Ruby/Rails

**URL:** <https://www.ruby-forum.com/t/soap-client-in-ruby-rails/138438>\
**Category:** Rails\
**Created:** [May 23, 2008, 12:36am UTC](https://www.ruby-forum.com/t/soap-client-in-ruby-rails/138438 "2008-05-23T00:36:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelleysislander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@kelleysislander](https://www.ruby-forum.com/u/kelleysislander)\
**Post date:** [May 23, 2008, 12:36am UTC](https://www.ruby-forum.com/t/soap-client-in-ruby-rails/138438/1 "2008-05-23T00:36:06Z")

</div>

Hi all. I have a need to build a SOAP client using Ruby and Rails. I’m  
accessing a document/literal style SOAP service. I’ve been poring over  
documentation (well, there really doesn’t seem to be any, so that’s a  
little misleading), blog posts, and outdated tutorials all day, and I  
still don’t really have anywhere to begin. Every tutorial seems to  
have a vastly different idea of how to do this, and most of them call  
for the use of classes or methods which seem to no longer exist. The  
SOAP4R rdocs as well as the docs for the SOAP stuff built into Ruby  
are almost completely empty. They list methods that the classes  
define, but remain frustratingly silent on what they’re for or how to  
use them.

I need a foothold here. Does anyone have any pointers to decent, not-  
outdated documents on getting started with SOAP as a client? Also,  
does anyone know if the SOAP stuff in Ruby does document/literal, or  
is it RPC only? I’ve read that SOAP4R can do it, but of course it’s  
not documented, so I have no clue how to begin.

I could really use a lifeline here if someone has one to toss me.

Thanks,  
-Bill

---

<div class="post-metadata">

**Author:** ![kelleysislander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@kelleysislander](https://www.ruby-forum.com/u/kelleysislander)\
**Post date:** [May 23, 2008, 12:46am UTC](https://www.ruby-forum.com/t/soap-client-in-ruby-rails/138438/2 "2008-05-23T00:46:03Z")

</div>

I just had the most unfortunate experience of writing a SOAP client in  
Ruby

require ‘soap/wsdlDriver’  
class VideosController \< ApplicationController  
def send\_soap  
XSD::Charset.encoding = ‘UTF8’  
wsdlfile = “[http://dev.espn.go.com:3004/test/test.xml](http://dev.espn.go.com:3004/test/test.xml)”  
driver = SOAP::WSDLDriverFactory.new(wsdlfile).create\_rpc\_driver  
driver.addAsset(false,“siteId”, “contentUploaderId”,  
“contentUploaderUsername”, “contentUploaderIp”, “#{@video.class.name}-  
#{@video.id}”, “fileTitle”, “filePath”, “contentType”,  
“contentSubtype”, “publicUri”)  
end  
end

Where addAsset is the name of the method you want to call.

SOAP is a terrible thing – that’s why you don’t find much  
documentation on it.

---

<div class="post-metadata">

**Author:** ![kelleysislander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@kelleysislander](https://www.ruby-forum.com/u/kelleysislander)\
**Post date:** [May 23, 2008, 12:55pm UTC](https://www.ruby-forum.com/t/soap-client-in-ruby-rails/138438/3 "2008-05-23T12:55:37Z")

</div>

Thanks for the code sample. Does that WSDLDriver to support document/  
literal, do you know?

And I agree with your take on SOAP. Unfortunately my hands are tied,  
I’m integrating with Google’s AdSense API, and it’s all SOAPy. ☹

-Bill

On May 22, 6:45 pm, “removed\_email\_address@domain.invalid” \<ESPN3.DL-

---

<div class="post-metadata">

**Author:** ![kelleysislander](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f6c823/32.png) [@kelleysislander](https://www.ruby-forum.com/u/kelleysislander)\
**Post date:** [July 2, 2008, 4:30pm UTC](https://www.ruby-forum.com/t/soap-client-in-ruby-rails/138438/4 "2008-07-02T16:30:18Z")

</div>

So have you gotten anywhere with this?

I want to make a google adsense checker, so that on my admin page I  
can show current adsense earnings, etc.

Any code help would be great.
