You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by he...@apache.org on 2012/10/24 21:35:41 UTC
svn commit: r1401835 -
/airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html
Author: heshan
Date: Wed Oct 24 19:35:41 2012
New Revision: 1401835
URL: http://svn.apache.org/viewvc?rev=1401835&view=rev
Log:
Fix to properly serialize the xml.
Modified:
airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html
Modified: airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html
URL: http://svn.apache.org/viewvc/airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html?rev=1401835&r1=1401834&r2=1401835&view=diff
==============================================================================
--- airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html (original)
+++ airavata/sandbox/client-api-demo/src/main/webapp/x_host_descriptor_save.html Wed Oct 24 19:35:41 2012
@@ -46,9 +46,29 @@ Gatekeeper Endpoint : <input type="text"
$('[name="btn2"]').click(function(){
//alert($(this).val());
alert("button btn2 clicked!");
- alert("" + "" + "" + "" + "" + "" + "" + "" + "");
+ var hostName = $("#hostName1").val();
+ var hostAddress = $("#hostAddress1").val();
+
+// var xml = $('<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type"><type:hostName>mylocalhost</type:hostName><type:hostAddress>127.0.01</type:hostAddress></type:hostDescription>');
+ var xml = $('<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type"><type:hostName>' + hostName + '</type:hostName><type:hostAddress>' + hostAddress + '</type:hostAddress></type:hostDescription>');
+
+ var xmlData= $(xml);
+ var xmlString;
+ if (window.ActiveXObject){
+ xmlString = xmlData.xml;
+ } else {
+ var oSerializer = new XMLSerializer();
+ xmlString = oSerializer.serializeToString(xmlData[0]);
+ }
+ console.log(xmlString);
+
+ alert(hostName);
+ alert(hostAddress);
+ alert(xmlString);
+
+ var string
$.post("http://localhost:7080/airavata-registry-rest-services/registry/api/hostdescriptor/save",
- { host: "<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type"><type:hostName>testHost1</type:hostName><type:hostAddress>aaaa</type:hostAddress></type:hostDescription"} ,function(data,status){
+ { host: xmlString} ,function(data,status){
// TODO : REST api should send some response back in case of a successful invocation of service.
// alert("Data: " + data + "\nStatus: " + status);
alert("Button 2 clicked !");
@@ -77,3 +97,14 @@ Gatekeeper Endpoint : <input type="text"
<!--<type:hostName>mylocalhost</type:hostName>-->
<!--<type:hostAddress>127.0.01</type:hostAddress>-->
<!--</type:hostDescription>-->
+
+<!--<type:hostdescription xmlns:type="http://schemas.airavata.apache.org/gfac/type">-->
+ <!--<type:hostname>gram-99</type:hostname>-->
+ <!--<type:hostaddress>gatekeeper2.ranger.tacc.teragrid.org</type:hostaddress>-->
+<!--</type:hostdescription>-->
+
+
+<!--curl -H "Accept: text/plain" -X POST -d 'host=<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type"><type:hostName>testHost3</type:hostName><type:hostAddress>aaaa</type:hostAddress></type:hostDescription>' http://localhost:7080/airavata-registry-rest-services/registry/api/hostdescriptor/save-->
+<!--curl -H "Accept: text/plain" -X POST -d 'host=<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type"><type:hostName>mylocalhost2</type:hostName><type:hostAddress>127.0.01</type:hostAddress></type:hostDescription>' http://localhost:7080/airavata-registry-rest-services/registry/api/hostdescriptor/save-->
+
+<!--<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type"><type:hostName>mylocalhost2</type:hostName><type:hostAddress>127.0.01</type:hostAddress></type:hostDescription>-->