ActionWebService & soap

Hi everyone,
I’m writing a Rails application which accepts file uploads via a form
and tracks them in a database - pretty simple stuff.
I now want to write a soap api to enable similar functionality from php
scripts.
Basically, I can get ActionWebService to publish a wsdl and I can go to
the url of the methods I create, but I’m not sure how to handle the file
upload part.

Are there any examples of this anywhere? Unfortunately, I can’t find
much, other than the initial config for Rails 2.0.

thanks in advance,
O

On Jul 21, 3:25 pm, Oliver F. [email protected]
wrote:

Hi everyone,
I’m writing a Rails application which accepts file uploads via a form
and tracks them in a database - pretty simple stuff.
I now want to write a soap api to enable similar functionality from php
scripts.
Basically, I can get ActionWebService to publish a wsdl and I can go to
the url of the methods I create, but I’m not sure how to handle the file
upload part.

The WSDL should have all the information required to upload data to
the service. If you want sample code, you may be able to generate it
from the WSDL using wsdl2ruby from the SOAP4R library. I wrote a
getting started guide here:
http://markthomas.org/2007/09/12/getting-started-with-soap4r/

Hope that helps.

  • Mark.

Mark T. wrote:

The WSDL should have all the information required to upload data to
the service. If you want sample code, you may be able to generate it
from the WSDL using wsdl2ruby from the SOAP4R library. I wrote a
getting started guide here:
markthomas.org

Hope that helps.

  • Mark.

Hi Mark,
thanks for the reply, and link - some good stuff there!
I’ve got things kind of working now. I can connect to my soap service
and call the create_document method with a few parameters. The problem
is, if the file is big (say 400Mb), it requires loading it into memory
on the consumer side and then again when it is transferred.

The server does something like:
#(document) is a array of strings
def create_document(name,document)
output = open(Tempfile.new(name),‘w’)
output.write(document.join())
output.close
return output.path
end

The file is readable and things work. Is it possible, in the event of
having a large file, to stream the file to the server in chunks?
I’ve found various code snippets, like adding
def in_chunks(size=1024) ; yield read(size) until eof? ; end
to File, but in terms of using it in the client - I’m stumped
(especially since I need to use PHP also).

Do you guys think SOAP is the right mechanism for this, or should I now
be using REST? (with REST, I’d http::post the above to my
create_document method?)

best,
a confused O.