# XML-RPC Webservice API

**URL:** <https://www.ruby-forum.com/t/xml-rpc-webservice-api/57980>\
**Category:** Rails\
**Created:** [April 17, 2006, 1:55pm UTC](https://www.ruby-forum.com/t/xml-rpc-webservice-api/57980 "2006-04-17T13:55:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [April 17, 2006, 1:55pm UTC](https://www.ruby-forum.com/t/xml-rpc-webservice-api/57980/1 "2006-04-17T13:55:32Z")

</div>

Hi,

After following the excellent tutorials in the Agile Web D.  
with Rails book, I was able to get my webservice working pretty much  
perfectly 🙂

I can access it via SOAP and XML-RPC and look at service.wsdl to find  
the API. What I can’t do however is get the API for the XML-RPC call. It  
fails with :

Internal protocol error: NilClass is not a valid input stream. It must  
be  
either a String, IO, StringIO or Source.  
Backtrace:  
/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:133:in `stream=' /usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:100:in`initialize’  
/usr/lib/ruby/1.8/rexml/parsers/streamparser.rb:6:in `initialize' /usr/lib/ruby/1.8/rexml/document.rb:173:in`parse\_stream’  
/usr/lib/ruby/1.8/xmlrpc/parser.rb:717:in `parse' /usr/lib/ruby/1.8/xmlrpc/parser.rb:475:in`parseMethodCall’  
/usr/lib/ruby/1.8/xmlrpc/marshal.rb:63:in `load_call' /usr/lib/ruby/1.8/xmlrpc/marshal.rb:32:in`load\_call’  
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action\_web\_service/protocol/xmlrpc\_protocol.rb:36:in  
`decode_request' /usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/protocol/xmlrpc_protocol.rb:32:in`decode\_action\_pack\_request’  
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action\_web\_service/protocol/discovery.rb:20:in  
`discover_web_service_request' /usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action_web_service/protocol/discovery.rb:18:in`discover\_web\_service\_request’  
/usr/lib/ruby/gems/1.8/gems/actionwebservice-1.1.2/lib/action\_web\_service/dispatcher/action\_controller\_dispatcher.rb:44:in  
`dispatch_web_service_request' (eval):1:in`api’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/base.rb:910:in  
`perform_action_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in`perform\_action\_without\_benchmark’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' /usr/lib/ruby/1.8/benchmark.rb:293:in`measure’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/benchmarking.rb:69:in  
`perform_action_without_rescue' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in`perform\_action’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/base.rb:381:in  
`process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:in`process\_without\_session\_management\_support’  
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/session\_management.rb:117:in  
`process' /usr/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in`dispatch’  
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel/rails.rb:66:in  
`process' /usr/lib/ruby/1.8/thread.rb:135:in`synchronize’  
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel/rails.rb:64:in  
`process' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:425:in`process\_client’  
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:424:in  
`process_client' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:495:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:494:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:483:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:774:in `run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:772:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/bin/mongrel\_rails:97:in  
`run' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel/command.rb:163:in`run’  
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/bin/mongrel\_rails:194  
/usr/bin/mongrel\_rails:18

I’ve tested it with Webrick as well and I get the same error. I’ve tried  
googling for it but I haven’t come across anything too useful. I’m  
wondering if there is a well known reason for this to happen when  
everything else seems to be fine…

Anyway, as always, any help you can give me will be gratefully  
appreciated 🙂

Cheers,

Pete

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [April 17, 2006, 2:40pm UTC](https://www.ruby-forum.com/t/xml-rpc-webservice-api/57980/2 "2006-04-17T14:40:04Z")

</div>

Can you post a small example which reproduces this problem?

It seems like the XMLRPC client that you use doesn’t send any xml to the  
server.

On 4/17/06, Pete [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> /usr/lib/ruby/1.8/xmlrpc/marshal.rb:63:in `load_call' `dispatch\_web\_service\_request’  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/rescue.rb:82:in  
> `process' /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.12.4/lib/mongrel.rb:774:in `run’  
> I’ve tested it with Webrick as well and I get the same error. I’ve tried
> 
> Pete
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

## – Kent

> **[DATANOISE.COM](https://www.datanoise.com/)**
>
> DATANOISE.COM - Contact us for any business inquiries

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [April 17, 2006, 2:46pm UTC](https://www.ruby-forum.com/t/xml-rpc-webservice-api/57980/3 "2006-04-17T14:46:12Z")

</div>

Pete,

> I can access it via SOAP and XML-RPC and look at service.wsdl to find  
> the API. What I can’t do however is get the API for the XML-RPC call. It  
> fails with :
> 
> Internal protocol error: NilClass is not a valid input stream. It must  
> be  
> either a String, IO, StringIO or Source.  
> Backtrace:  
> [snip]

I see the same error message. My guess is that this is the same as the  
“Typo bug” that has bit so many. It bit me when I was trying to  
generate XML-RPC documentation for a customer. (It’s not a bug in  
Typo, it’s a bug in Rails. See  
[http://www.mail-archive.com/removed\_email\_address@domain.invalid/msg01648.html](http://www.mail-archive.com/removed_email_address@domain.invalid/msg01648.html))

## Jim

Jim M., removed\_email\_address@domain.invalid, removed\_email\_address@domain.invalid  
[http://www.io.com/~jimm](http://www.io.com/~jimm)

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [October 24, 2006, 9:07am UTC](https://www.ruby-forum.com/t/xml-rpc-webservice-api/57980/4 "2006-10-24T09:07:55Z")

</div>

I am having the same problems… The error messages are pretty much the  
same… I would really like to get this working with AWS and not have to  
have a standalone SOAP server communicating through something like a  
socket. It’s just not the Rails Way ™

William

Pete wrote:

> I don’t suppose there is a known solution to it? 🙂
> 
> I could only find info on Typo when I was googling…
> 
> Cheers,
> 
> Pete

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [April 17, 2006, 2:48pm UTC](https://www.ruby-forum.com/t/xml-rpc-webservice-api/57980/5 "2006-04-17T14:48:32Z")

</div>

I don’t suppose there is a known solution to it? 🙂

I could only find info on Typo when I was googling…

Cheers,

Pete

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [December 7, 2007, 9:18am UTC](https://www.ruby-forum.com/t/xml-rpc-webservice-api/57980/6 "2007-12-07T09:18:05Z")

</div>

Hello,

I have the same problem here : I am trying to implement a Web Service  
via AWS from a wsdl (for legacy reasons).  
Did you find out something ?

David

On 24 oct 2006, 16:24, William [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![pete](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/3ab097/32.png) [@pete](https://www.ruby-forum.com/u/pete)\
**Post date:** [October 24, 2006, 5:24pm UTC](https://www.ruby-forum.com/t/xml-rpc-webservice-api/57980/7 "2006-10-24T17:24:41Z")

</div>

Alright, so I can get a SOAP client to talk to ActiveWebService, which  
is great, however, the main point of this endeavor is an integration  
with QuickBooks Web Connector, which is a SOAP client. However, the QBWC  
SOAP client wants to just access the ActionWebService SOAP server like  
this:

Parameters: {“action”=\>“api”, “controller”=\>“qbwc”}

This causes Rails to spit out something very similar to the error  
messages that the starter of this thread was getting.

My SOAP client, called from ActionWebService::Client::Soap.new, works  
fine, but it access the server like this:

Parameters: {“\<?xml version"=\>"\"1.0\" encoding=\"utf-8\" ?\>\n\<env:Envelope xmlns:xsd="[http://www.w3.org/2001/XMLSchema\](http://www.w3.org/2001/XMLSchema%5C)”\n  
xmlns:env="[http://schemas.xmlsoap.org/soap/envelope/\](http://schemas.xmlsoap.org/soap/envelope/%5C)“\n  
xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance\](http://www.w3.org/2001/XMLSchema-instance%5C)”\>\n env:Body\n  
\<n1:Authenticate xmlns:n1="urn:ActionWebService"\n  
env:encodingStyle="[http://schemas.xmlsoap.org/soap/encoding/\](http://schemas.xmlsoap.org/soap/encoding/%5C)“\>\n  
\<param0 xsi:type="xsd:string"\>test\n \<param1  
xsi:type="xsd:string"\>test\n \</n1:Authenticate\>\n  
\</env:Body\>\n\</env:Envelope\>”, “action”=\>“api”, “controller”=\>“qbwc”}

Now, is this something peculiar about Intuit (the makers of QuickBook  
and QBWC) or is this a Rails related issue. I know that “AWS does not  
try to implement every facet of the WC3 specifications for SOAP” (from  
Agile by Thomas an DHH). Should I be using some other SOAP library, such  
as SOAP4R, in order to get this type of scrict functionality that QBWC  
is demanding, or is there a way around this?

“In general, there are two approaches to building SOAP web services and  
their clients (code- first and WSDL-first), with a fair degree of  
religious argument for each approach, however there is little dispute  
that when interoperability is important, a WSDL-first approach makes the  
most sense. In the case of the Web Connector, the Web Connector is  
acting as a SOAP client which was written based on a canonical standard  
.NET web serviceâ??s WSDL, so we followed the WSDL-first approach to  
building the client and as we went through the process of testing with  
.NET and Java web services we found the WSDL-first approach to be the  
most reliable method of ensuring that the web services we built to  
support the web connector remain compatible with the web connector. In  
fact, we spent quite a bit of time tracking down what appeared to be  
bugs in the web connector (and were certainly less than graceful  
failures) that turned out to be caused by web services that did not  
conform to the WSDL we expected! We therefore strongly recommend a  
wsdl-first approach to developing a web service that works with the web  
connector!” (from QBWC PDF)

Now, I know that SOAP4R has a wsdl2ruby script, however I’ve never  
gotten it to run. Does ActionWebService have the ability to turn a WSDL  
file in to a service API, aka, wsdl2AWS? That would be a great feature.

What I’m guessing is that QBWC is very anal and is probably not going to  
work with AWS, and judging by my luck recently, not going to work with  
SOAP4R either, which means I’m going to have to have some standalone PHP  
soap server talking to my Rails app in some RESTful manner… freaking  
nightmare. 🙂

It is good to know that there’s others out there having simular issues,  
however.

William
