# Consuming .Net Web Services?

**URL:** <https://www.ruby-forum.com/t/consuming-net-web-services/132273>\
**Category:** Rails\
**Created:** [March 18, 2008, 4:51pm UTC](https://www.ruby-forum.com/t/consuming-net-web-services/132273 "2008-03-18T16:51:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [March 18, 2008, 4:51pm UTC](https://www.ruby-forum.com/t/consuming-net-web-services/132273/1 "2008-03-18T16:51:43Z")

</div>

Ok… Anyone have any experience with .NET webservices?

We have a site that we’re re-doing in Rails, that was done in .NET,  
and there’s a desktop application to it that we want to keep using for  
awhile during the switch.

To get the data in to the MS SQL database that the software uses, we’d  
like to use a WebService, and connect to it with the Rails app to dump  
the data into the database. Now assuming I’ve figured out how to make  
my webservice, and I have it up and running… how does Rails connect  
to .NET services… is there a plug-in I need to use? Or rather is  
there a plug-in I should use?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [March 18, 2008, 5:00pm UTC](https://www.ruby-forum.com/t/consuming-net-web-services/132273/2 "2008-03-18T17:00:01Z")

</div>

If I understand your Q, you are wanting .NET to consume a Rails  
webservice(not the opposite)? If so, you’ll need to generate a WSDL  
from your Rails app. Here’s a link :[http://benrobb.com/2007/01/30/](http://benrobb.com/2007/01/30/)  
howto-put-wsdl-on-rails/

Then you’ll have .NET generate the stub code to call and consume. From  
there you are in your .NET and should be able to interface MS SQL.

That being said, I think using Rails to get MySQL to MS SQL is not the  
only option. You could simply use mysqldump to create a CSV, copy to  
the MS SQL Server (use pscp to pull the file), use DTS to import and  
then automate the whole thing via cron and Windows ‘at’. This would  
keep the web out of data syncronization, which sounds like what you  
are trying to do.

Thanks,  
Hank

---

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [March 18, 2008, 5:14pm UTC](https://www.ruby-forum.com/t/consuming-net-web-services/132273/3 "2008-03-18T17:14:09Z")

</div>

I want to consume a .NET web service with rails. Basically it’s a big  
form that is submitted to a MS SQL database. The data is used to  
generate a bunch of reports, and so forth with a .NET Desktop  
Application, and the reports are then going to be uploaded from the  
Desktop Application to the Ruby on Rails webserver for access by the  
end user.

The data needs to be put into the MS SQL database in real-time, and it  
is not a simple synchronization. The data from the one form is put  
into about 5 different tables in the .NET application, and need to  
remain that way for the desktop software to work. I figured  
converting the sumbission method from the .NET application into a web-  
service, and consume it with Rails, would be the easiest way to  
complete this.

Maybe I’m wrong?

---

<div class="post-metadata">

**Author:** ![sw0rdfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/edb3f5/32.png) [@sw0rdfish](https://www.ruby-forum.com/u/sw0rdfish)\
**Post date:** [March 18, 2008, 6:20pm UTC](https://www.ruby-forum.com/t/consuming-net-web-services/132273/4 "2008-03-18T18:20:28Z")

</div>

I have had experience with this before. You might find this helpful:

[http://wiki.rubyonrails.com/rails/pages/How+To+Consume+.NET+WebServices](http://wiki.rubyonrails.com/rails/pages/How+To+Consume+.NET+WebServices)

I ended up using a combination of Soap4r[1] and ReXML (probably would  
have used Hpricot if it was around) rather than using the Rails Web  
Services module. Basically created model objects that mapped to models  
against the web service to hide all the ulginess of working with  
SOAP 🙂

[1] [http://dev.ctor.org/soap4r](http://dev.ctor.org/soap4r)

Let me know if you need any more info.

Cheers,  
Nicholas
