Mashup Code Sample - EMML Hello World

Posted 09/16/2008 - 12:56 by admin

This is a great beginner's example of EMML (Presto's Enterprise Mashup Markup Language).

In your development directory create a text file called 'helloworld.emml'. Here's the sample EMML to put into this file: <?xml version="1.0" encoding="UTF-8"?> <mashup xmlns="http://www.jackbe.com/2007-09-15/JMMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.jackbe.com/2007-09-15/JMMLSchema ../xsd/JMMLSpec.xsd " name="HelloWorldMASHUP">  <operation name="getResponse"></operation> <outputparam name="result" type="document"></outputparam>  <constructor outputvariable="result" />  </mashup> This mashup will simply use the Presto constructor operator to make an XML document, with an element item, and a child element response, with the words 'Hello World'. The constructor places the output into the variable result which is the outputparameter for the mashup - see the element.

Open your console/terminal session, go to the mashupclient directory -
/edge/mashupclient/bin. You can test this mashup, without yet saving/registering it to Presto, with the command ( I'm using the UNIX version, substitute the .bat extension for Windows - and I have a project directory with the emml file ) ./emml.sh -f ../../../server/apache-tomcat-5.5.20/webapps/July1107/WEB-INF/src/emml/helloworld.emml -u admin -p adminadmin

The -f parameter precedes the location and emml filename, -u procedes the user id to Presto, and -p the user password. You will see the XML result in the console/terminal session. When you're happy with the result, save it to Presto with the adjusted command: ./emmlpub.sh -f ../../../server/apache-tomcat-5.5.20/webapps/July1107/WEB-INF/src/emml/helloworld.emml -u admin -p adminadmin

If successful, you will see the message in the console/terminal session "Service successfully registered."

You need to activate the mashup, so log into Presto (http://localhost:8080/Presto), and log into Service Explorer - find the mashup under the mashup node in the left tree, and click the Activate button. Now it's ready to be viewed / consumed.

You can quickly view the result using the REST web service API to Presto by typing the following command into your browser address bar: localhost:8080/presto/edge/api/rest/HelloWorldMASHUP/1.0/getResponse/?presto_username=admin&amp;presto_password=adminadmin

Depending on the browser, you will get the XML result of the Hello World mashup, and will look something like this: <item> <response>Hello World!</response> </item>

4.25
Your rating: None Average: 4.3 (4 votes)
Consider EMML replaced JMML

JMML command is not there anymore, we are using EMML since a long time ago. :)

Posted by orincon on Wed, 10/01/2008 - 12:11