Consume SOAP web service in Ruby 1.9 and Rails 3? - ruby-on-rails

I'm trying to consume a SOAP web service, (from SharePoint 2010 if it makes a difference). I'm using Ruby 1.9 and Rails 3. What is the best way to do this? I've read some stuff mentioning Savon http://savonrb.com/ but that is was too new and buggy. Is it still the best solution? Thanks.

I used Savon successfully to interact with the Bullhorn Staffing SOAP based service about six months ago. I didn't have any problems with the Savon Gem, all my headaches came from inconsistencies with the service.
My interactions with their service was limited to getting data (simple) and pushing data, which could include a resume file (more complex). I didn't have to look much further than the Savon doc to figure everything out, which I thought was simple to understand and easy to apply to my particular set of problems.
TLDR; 1 vote for Savon despite what you may have heard.

I used savon to interact with Jira SOAP API and it worked fine.

Related

How to use Rails as DDP server with Meteor.js client

We have a Rails app that acts HTTP API only. On the client side, Ember.js is currently used. We are not overly impressed by Ember and really like the approach Meteor.js takes. So we'd like to exchange the client side with Meteor.js and communicate with the Rails server via websockets that speak the Data Distribution Protocol (DDP), so we can keep using the models, mailers and controllers in Rails. Implementing server side of DDP should be easy.
However, we're unsure how to make Rails talk websockets. We found Reel, which seems to make it easy to accept websocket requests in a standalone environment. Reel seems great as we'd like to implement the DDP on top of the Celluloid stack anyway. But what about running Reel in the Rails environment? Would we need "rails runner" for that? And we'd like to keep using the existing controllers to dispatch incoming requests (like, to add/change/remove resources). Is that even possible without having the request coming through Rack?
Any input is appreciated.
It's a bit late, but I've implemented DDP in Ruby, you can check it out here:
https://github.com/d-snp/ruby-ddp-server
It includes an implementation of EJSON as well. It's built on top of celluloid-websocket, and can be ran simply as a rack app.
I've made an integration with RethinkDB that can be used as a reference to build your own collections implementation.
https://github.com/d-snp/ruby-ddp-server-rethinkdb
I've also made a sample chat application that can be found here:
https://github.com/d-snp/celluloid-rethinkdb-chat
It's something that I have been longing to do as well, to integrate old "legacy" Rails code. Here is the best way I have found:
Since you would not be using any of Rails router/controller/views, but just the ability to read data and push it to the client, I recommend you use Rails to create JSON apis to the database, and deploy the code, then in Meteor you can consume the data via the http package, this would happen on the server at a regular interval and populate the MongoDB with the normalized data you need, then it would serve the browser client.
I am working on such an application that will keep a normalized version of the data in Mongo, and a relational version of the data in mySql (through Rails) this way I can preserve the legacy Rails functionality that I dont want to rewrite in JS, and get the benefit of Meteor for the one page that I need it most.

Soap based web services using ruby on rails framework

Is it possible to write soap based web services using ruby on rails framework. If yes, can someone please point to a learning resource
Yes, you can write SOAP web services using Rails, However Rails is moving in favour of a REST web service approach. So my personal opinion is if you are starting a brand new Rails app with SOAP web services, consider some other programming language like JAVA, because that has more tools to easily create SOAP web services.
But nowadays all the webservices going towards REST, because of the simplicity it has. Almost all major sites has a REST API.
Furthermore if you are still planning to go ahead with Rails, savon is an interesting gem that you should probably look at.

Rails 3 and graph databases

A Rails 3 application running on Postgresql needs to switch to a graph database to be able to grow up. There are many of them and they all offer different kind of API, REST mostly.
I am highly inspired by talks of Emil Eifrem, CEO of NeoTechnologies, about what can be accomplished with Neo4j. I must confess, I've played with it and this thing is absolutely what we need, but there are several obstacles.
REST API is not transactional.
Rails 3 apps are running on ruby 1.9.2, but not jRuby 1.5.3 or 1.6 to achieve native API.
Some databases are also driven by Java and offer REST API, so taking them changes nothing. Someother are not an option for us because of a license or a cost or a lack of team behind them.
I assume I'm missing something, so would appreciate any tip, insight or advice about what are our options and and what can play well for us. Thanks.
You can run Neo4jrb with Rails 3 on jruby 1.6, so that should not be a problem.
To run a transactional (REST) API on top of that you can easily write your own Neo4j-Server plugin/extension that could also use Neo4jrb internally but exposes an API that fits your domain and is less verbose/chatty than the fine grained Neo4j-Server REST API. This should also be easier to consume for your clients as it talks in your terms, vocabulary and use-cases.
We're currently working on creating a generic (j)ruby server extension that is able to consume posted code and make it available as new REST endpoints.

Implementing a SOAP 1.2 server with Rails 3

SOAP? Why would you use that?
I am using Ruby Enterprise Edition and Rails 3 to write my web application. The application uses Ustream's Watershed white label broadcasting services to provide live streaming for my users. Unfortunately I have hit a snag during development. Watershed allows an application to provide it's own authentication layer through the implementation of a SOAP service on the application side of things. This authentication layer must be implemented in SOAP 1.2 to work with Watershed. To my great dismay, it seems that the Ruby community has moved on past ye'old SOAP towards a brighter future filled with REST and Unicorns.
This makes me happy 99.9% of the time. However right now I need to make a SOAP 1.2 endpoint in my shiny new Rails 3 application.
If anyone has any suggestions or libraries that I can use, I would be very thankful.
Things I have done already
Tried the built in SOAP support in Ruby. Unfortunatly it seems that it does not support SOAP 1.2.
Looked at WSO2 but didn't want to build an extensive set of Ruby extensions on my server just to support SOAP.
Thought about hard-coding xml responses before deciding that I am a lazy programmer.
It's been a while since this Q was posted, but hey, SOAP isn't speeding off either. I guess you've implemented something, care to share?
Anyway, as a kind of answer, I've been blessed with a customer forcing me to consume his SOAP services (their awesome SOA platform doesn't support other formats...) both for pulling and pushing data. I only consume, as I provide nice and clean RESTful Web Services myself for others. I've been using savon (french for soap?) with great success
http://savonrb.com
If you're truly lazy, you'll hard code the SOAP envelope structure and input your dynamic data. Here's a simple example.
def soap_envelope(pCode)
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:prod='http://xmlns.aBigCompany.com/path/to/NeededService'>
<soapenv:Header/>
<soapenv:Body>
<something:NeededServiceRequest>
<something:productCode>#{pCode}</something:productCode>
</something:NeededServiceRequest>
</soapenv:Body>
</soapenv:Envelope>"
end
And this is one way to use it
products_wsdl = Savon::Client.new "http://ipAtBigCo:xxxx/path/to/services/NeededService?wsdl"
begin
response = products_wsdl.process! do |soap|
soap.xml = soap_envelope("someProductCode")
end
rescue => e
MyLogger.error "Error: SOAP call for code #{pCode} failed. ++"
raise e
end
response.to_hash # This is the nice part
About SOAP 1.2, savon supports it. About actually being a SOAP service provider, I haven't done it in rails (fight it!) and can only wish you good luck. Having to develop the stupid WSDLs yourself is the real pain with SOAP services. Hope this helps anyone.
If you cannot avoid SOAP in Rails 3, then try wash_out gem. You can find it at: https://github.com/roundlake/wash_out
We used in our system. It is not fool-proof and still undergoing some changes, at least you would get started
Although Rails 3 onwards, they have kind-of stopped supporting SOAP - wash_out gem helps you to get started with creating SOAP webservice faster. Anyone interested should have a look at the wash_out wiki on github. In our case, client wanted a SOAP webservice to be exposed; we tried to go the REST way. In the end, we had to say yes to SOAP. I tried aws, soap4r - but wash_out turned out to be best fit.
You can use this gem for soap implementation
savon
You may find what you are looking for here http://aws.rubyonrails.org/

Integrating Oulook/Exchange Tasks with Linux-based Rails

Is it possible to integrate MS Outlook/Exchange tasks with Rails? I know how to send emails with Rails, but that isn't using anything "special" about exchange, just pointing it at the server.
What is "special" about an Outlook Task and how I can I create/read/update/delete them from Rails. (Even a subset of CRUD would be great.)
PS. I am on a linux based rails system, so solutions that rely on a windows-only function won't work for me.
If you are running Exchange 2007 you should also look at Exchange web services to manipulate things.
I am in the process of building a MS Exchange client access library in Ruby that uses MS Exchange Web services. The code is GPL'd so have at it. Please let me know what kind of issues you have and what other features you'd like to see. It's pretty heavy in development at this point.
http://github.com/zenchild/Viewpoint
Cheers,
Dan Wanek
WebDAV might be the way to go, if you'd like to do it in Ruby. There is a ruby gem call rexchange that can do the trick. However, MSFT is phasing out WebDAV and replacing it with the Exchange Web Services, which is Zoredache suggested. Unfortunately, MSFT only provides API in C# (technically, it's SOAP stuff that is language-agnostic, some Java developers seem to sucessfully build some stuff using EWS, but I have yet known anyone has done this in Ruby.)
Assuming that the tasks are stored in Exchange, you should be able to access the tasks through WebDAV.

Resources