Creating a new REST mashable service

nzblue_fish
nzblue_fish's picture
User offline. Last seen 2 weeks 4 days ago. Offline
Joined: 09/30/2009
Points: 1165

Hi mashers,

just following up on a recent post regarding the use of the Excel Connector to publish XML services. Although using the Excel Connector was one way of doing this, it was suggested that a better way might be to create a RESTful web service in order to publish the XML file.

Can this be done by leveraging the Tomcat environment established when Presto was installed?

I came across one method using the Web and Java EE version of NetBeans IDE and Tomcat and wondered if anyone had tried this, and whether it can be done without breaking the Presto environment! Is there another easy way of creating and publishing RESTful web services that would be better (or simpler to implement).

Cheers, Innes (NZ)

0
Your rating: None
aishmishra
aishmishra's picture
User offline. Last seen 10 weeks 6 days ago. Offline
Joined: 09/24/2008
Points: 3

Hi Innes,

i. Ideally, yes you can use the Tomcat instance that Presto is running in to deploy other web applications - a REST service in this case.

ii. However, looking at your previous posts, you have done quite a good amount of work on Presto. In this situation I would suggest using a separate instance of tomcat (could be on the same machine but different port). Once you have tested it you can deploy it on the original tomcat instance.

iii. If your REST webservice simply provides an XML file, then you can just create a web folder in tomcat's webapps folder and copy the XML file there. In that case the XML file will be available at

http://localhost:8080/<web-folder-name>/<xml-file-name>

Do let us know in case you have queries!!!

smitchell
smitchell's picture
User offline. Last seen 17 hours 19 min ago. Offline
Joined: 08/29/2008
Points: 34

And just to make sure you have too many ways to work with XML files (), there is one other way using a built-in Presto macro: <macro:XMLConstructorFromFile>. You simply add your XML file to {web-apps-home}/presto/WEB-INF/classes and then call this macro in any mashup and provide the name of your XML file. The XML populates the result of the macro and you can use it.

For more information, see the docs at http://www.jackbe.com/prestodocs/v2.7.0/prestolibrary/index.html. Then search for the macro name.

 

Sara, technical writer/jackbe

 

nzblue_fish
nzblue_fish's picture
User offline. Last seen 2 weeks 4 days ago. Offline
Joined: 09/30/2009
Points: 1165

Hi Aishwarya, Sara,

You guys rock ... thanks for the feedback and the suggestions. It's so nice to get such prompt and helpful responses to my questions.

On this topic, I came across a reference to using Grails to publish RESTful services. I'm going to take a look at that as well since I have an interest in using Groovy anyway.

I'll let you know how these methods worked out when I get a chance to test them out.

Cheers, Innes (NZ)