Sunday, November 20, 2011

SOAP Request Gadget with WSO2 Gadget Server

The duty of this gadget is to invoke a SOAP Web Service.

The installation guide of the WSO2 Gadget Server can be found here. The guide to write and deploy a gadget in the WSO2 Gadget Server can be found here

First the soap web service should be startup

i have used the helloService of axis2. (Start the axis2 server in order to use it)

Use the following and deploy it in WSO2 Gadget Server.

<?xml version="1.0" encoding="UTF-8" ?> 
    <Module> 
    <ModulePrefs title="hello world example"> 
    <Require feature="wso2.soap"/> 
    </ModulePrefs> 
    <Content type="html"> 
    <![CDATA[
    <div id=response-disp></div>
 
<script>
function doSOAPCall(){
    var endpoint = "http://localhost:8081/axis2/services/SimpleService.SimpleServiceHttpSoap12Endpoint/";
    var payload = ' <p:helloService xmlns:p="http://sample"> <p:msg>SOAP Request </p:msg> </p:helloService>';
    var operation = "urn:helloService";
    document.getElementById("response-disp").innerHTML = wso2.io.makeSOAPRequest(endpoint, operation, payload);
}
gadgets.util.registerOnLoadHandler(doSOAPCall);
    </script> 
    ]]> 
    </Content> 
    </Module> 



No comments:

Post a Comment

Using Zotero for academic writing