Forum: Ruby on Rails XML-RPC Webservice API

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ef31136ad29b9ce06c9f718109a584cc?d=identicon&s=25 Pete (Guest)
on 2006-04-17 13:55
Hi,

After following the excellent tutorials in the Agile Web Development
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
3ccecc71b9fb0a3d7f00a0bef6f0a63a?d=identicon&s=25 Kent Sibilev (Guest)
on 2006-04-17 14:40
(Received via mailing list)
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 <miggyx@peteslan.net> 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/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Kent
---
http://www.datanoise.com
C9a82c17d27c7aa011b00ae22df51458?d=identicon&s=25 Jim Menard (Guest)
on 2006-04-17 14:46
(Received via mailing list)
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/typo-list@rubyforge.or...)

Jim
--
Jim Menard, jimm@io.com, jim.menard@gmail.com
http://www.io.com/~jimm
Ef31136ad29b9ce06c9f718109a584cc?d=identicon&s=25 Pete (Guest)
on 2006-04-17 14:48
I don't suppose there is a known solution to it? :)

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


Cheers,


Pete
1d6ff674c0fe4c104c611ad4273f88d0?d=identicon&s=25 William (Guest)
on 2006-10-24 09:07
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 (tm)

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
1d6ff674c0fe4c104c611ad4273f88d0?d=identicon&s=25 William (Guest)
on 2006-10-24 17:24
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\"\n
xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"\n
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n <env:Body>\n
<n1:Authenticate xmlns:n1=\"urn:ActionWebService\"\n
env:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n
<param0 xsi:type=\"xsd:string\">test</param0>\n <param1
xsi:type=\"xsd:string\">test</param1>\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
1e6fa64397f2dbfd76f219b12a67098a?d=identicon&s=25 David Bourguignon (Guest)
on 2007-12-07 09:18
(Received via mailing list)
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 <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.