Call Rails API in Oracle BPEL - ruby-on-rails

I'm trying to integrate a simple Rails app with a BPEL process but it's been hard since BPEL has few or maybe none support for RESTfull web services.
I've tried already using a HTTP binding but i'm not sure if I got what I want since the component moved to the internal side, and it's actually an external service.
So I have two questions:
I needed to write the xsd file to define the request and response xml structure. I searched and it seems there is no gem for doing this automatically. Is there any? Or even better, is there a gem that creates something like a wsdl file? I know this is for SOAP web services and in RESTful there is no such thing, but creating this files by hand is a pain in the ass. So I search something similar.
HTTP binding is the only way I found to call a RESTfull web service. Is there anything better? Has anyone been successful using it? Or code it in Java and use the Java adapter or something would be easier?
Any suggestion, even if not directly for my questions are appreciated. Thanks.
Also if there are some articles about it, links are welcome.

WashOut is a new SOAP server library and definitely worth checking out.

Related

Blackberry - Consume .Net Soap Service

I am new to blackberry app development and was wondering if someone could point me in the right direction(and may be a sample application) of how to consume web service in native apps. I'm using Blackberry JDE plugin for Eclipse.
I am able to consume a restful webservice, but now I want to consume a SOAP service. I am new to eclipse , so I would require in detail information.
Thanks,
I followed this none-ksoap2 route and it worked well for me:
http://www.johnwargo.com/index.php/blackberry/dbja2.html
This series of articles explains how to utilise the support the BlackBerry Platform has built in for JSR 172, the J2ME Web Services Specification, by creating a java stub class through the use of a utility in the Sun Java Wireless Toolkit for CLDC and the wsdl for your web service.
The articles give a very thorough and detailed explanation of the steps required to achieve the objective, so I would not wish to repeat them here in full, nor paraphrase them at the risk of my debased shorter version being quoted later. I understand the risk of answering in this way, and I realise that my short explanation above will in no way compensate should the original articles disappear from the internet.
Hey thanks for all the help. Figured it out. The problem was wcf service. When I tried with a simple web service(.asmx), it worked like charm and all the stubs were generated correctly. Probably wcf uses Soap 1.2 default and asmx service SOAP 1.1.
I even tried using KSOAP2 for calling wcf service with little success. Again switching back to asmx instead of wcf, solved the issue.
Now I have problem of plenty, which method to use(KSOAP or Stub) :)
I am all for non KSOAP method, but the only thing that is stopping me is I have to generated stub files everytime a introduce a new method.
Anyways +1 for all the help

how to create a web service

I building a website with Ruby on Rails framework.
The site will contain a flash application that will interact with the rails application using web service.
My partner builds the flash application and he told me that the flash application interacts through WSDL file.
I am new to web services. I would like to know how to create the WSDL file, and how to make the interaction between the rails application and the WSDL file.
If you believe that there are better alternatives than SOAP/WDSL, I would like to hear them too.
Thanks,
Oded
Have you Googled how to build web services in Ruby? Here are a few links that come up, all addressing exactly what you want to do:
http://www.tutorialspoint.com/ruby/ruby_web_services.htm
http://www.ibm.com/developerworks/opensource/library/os-ws-rubyrails/index.html
http://searchsoa.techtarget.com/tip/Web-services-with-Ruby-on-Rails
How about you take a look at some of those links, and come back to us if you have further questions.
I do have one elaboration:
My partner builds the flash
application and he told me that the
flash application interacts through
WSDL file.
It sounds like your partner has an incomplete understanding of how Flash can access remote data services. Using a SOAP Web Service with a WSDL is one method, for sure, and here is some documentation on that.
A Flex / Flash application can also make standard HTTP calls, sometimes called REST Web Services. In many cases, REST Web Services will return an XML Document, but that is not required. Any data, including simple text data, can be returned from a REST Web Service.
What many people prefer to do is to use an AMF Gateway with RemoteObject. AMF is a binary format so you'll get much smaller file size transferred back and forth than the alternatives. It also provides for automatic object translation between your server side objects and client side objects. This can be a time saver in development because you don't have to parse data to turn it into something Flex can use easily. RubyAMF is one Ruby implementation of AMF.
You'll be going through more pain than you need to by using WSDL.
Instead, I recommend creating a REST interface that returns json (or xml) -- you'll find in rails it will just work.
So you'll have things like:
/books # returns a list of books. Also do Searching here
/books/1 # return the detail of a book with ID of 1
Search for "REST Rails" and you'll get examples of controllers that will return JSON and XML depending on what the client requests.

Access Web Services on BlackBerry

What are the ways of accessing web services on a BlackBerry device?
I've learned about XML for webservices. We use SAX and DOM parsers in Blackberry. Are there any more ideas like this?
I also want to know what KSOAP is and how to use it on BlackBerry.
AFAIK, kSOAP is a library that lets you post soap requests to your web service. If the service accepts a simple POST request, the easiest way would be to use HttpConnection. Here's a good tutorial
I've also used kXML2 for XML parsing, and that has worked out well for me till now.
Additionally, including 3rd party libraries is a pain (kSOAP and kXML), so here's a guide that will hopefully save you some time.
You can try http://wsclient.neurospeech.com/wsclient/java-android-blackberry/ which supports soap code generation for blackberry with additional library that manages everything, it generates native typed soap client and calling them is very easy. Otherwise you will be spending lot of time in xml to your types and types to xml conversions and so on. Plus date and many things are little complex to handle.

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