views:

109

answers:

2

This is more of a technology stack question.

the C# logic is pre-existing / legacy and is internally a multiple-machine/distributed app. My need is to implement an overview web interface. So I've been looking at doing a prototype in Ruby On Rails.

Now my knowledge is a day or 2 old here... so correct me if i am wrong. there used to be something called ActionWebServices (AWS) - which is now out of the core distrib. ActiveResource has taken its place in Rails 2.0. You can still get AWS by doing a gem install... (however couldn't find an AWS tutorial)

So looking at ActiveResource (Ares): Now Ares is opinionated.. it expects the target web service to be Restful, follow a certain pattern of URLs and accept XML as input

Now my question here is what do I use to implement the wrapper web service?

  • If I use Rails to do the web service as well.. I think I'm going to have some Ruby-C# interop issues (is it even possible? Can I do this via the MS-impl IronRuby?)
  • If I do the web service using an MS specific thing e.g. ASP.Net, Ares wont talk to it. Can you satisfy the Ares constraints via ASP.Net somehow?

Pardon my general ignorance of the web world.. and thanks for reading.

+2  A: 

Ähm... Webservice process methods with data recieved via the html-actions (put, post, get, delete).

So you shoulnt have problems with rails/c#.

And if your c# webservice doesnt provide a restful interface, you can create an xml-file manualy and post it via rubys http-class:

http://ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html#M000683

f.e.:

postdata = "<xml version=1.0><root><data1 value=1>asdasd</data></root></xml>"

response = http.post('http://c-sharp-website.com/getdata', postdata)

If you want to create the webservice as a ruby on rails application, you have to provide further information, f.e. if you want to access c# classes from your rails application.

EDIT:

You can use c# libraries with iron ruby: http://www.kevinblake.co.uk/using-c-net-libraries-within-ironruby/602/

Lichtamberg
Yes the webservice would have to call on some C# methods... I'm investigating the link/path you provided. thanks..
Gishu
A: 

Maybe not the right answer.. but I took the path of least resistance and succeeded. Yay Ruby!

First I did a dummy Asp.net Xml Web service as shown in this walkthrough. Less hassle to talk to my C# code.
Next I found this uber-blog post by Ryan Heath and it was all downhill after that.

You write a tiny wrapper Ruby class like this which gets the WSDL from the parameters you seed it with. It scans the WSDL and then you can invoke your web methods as simple instance methods. Yay Ruby!

More details in my blog post in case you're piqued

Gishu