Writing a Hello World Client
The Mashup Server supports the quick and easy creation of Web services clients written in HTML and Javascript. You can use the Javascript stubs (?stub) generated by the Mashup Server to invoke the mashup services from your web page.
Mashup server also has the concept of bundling a custom UI along with the service. Follow these simple steps to write & expose a simple client for the helloworld service (Assuming the author of the helloworld service is bob):
Note: The Mashup server should be running the helloworld service for this to work.
Step 1:
In Notepad or your favorite html editor, type the following text:
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Hello World Client</title>
<script type="text/javascript" src="/js/wso2/WSRequest.js"></script>
<script type="text/javascript" src="/services/bob/helloworld?stub"></script>
</head>
<body>
<p>
<script>
<!-- use the generated stub to call the mashup service -->
var response = helloworld.hello();
<!-- write the response to the browser -->
document.write(response);
</script>
</p>
</body>
</html>
Step 2:
Save the above as "index.html" in the directory "scripts/bob/helloworld.resources/www" within the Mashup Server directory. Now you'll be able to see the newly created page when browse to the service endpoint (eg: http://localhost:7762/services/bob/helloworld).
Thats it, its so simple.