[mashup-dev] svn commit r4632 - in trunk/mashup/java/modules/www: . js/wso2

svn at wso2.org svn at wso2.org
Mon Jul 2 01:38:49 PDT 2007


Author: tyrell
Date: Mon Jul  2 01:36:19 2007
New Revision: 4632

Modified:
   trunk/mashup/java/modules/www/home.html
   trunk/mashup/java/modules/www/js/wso2/mashup-utils.js
   trunk/mashup/java/modules/www/js/wso2/services.js
Log:
Adding client side code for mashup downloading to a remote mashup server.

Modified: trunk/mashup/java/modules/www/home.html
==============================================================================
--- trunk/mashup/java/modules/www/home.html	(original)
+++ trunk/mashup/java/modules/www/home.html	Mon Jul  2 01:36:19 2007
@@ -1,203 +1,234 @@
-
 <html>
 <head>
 
-    <title>WSO2 Mashup Server v at mashup_version@ Management Console</title>
-
-    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
-
-    <meta name="description" content="WSO2 Mashup Server v at mashup_version@"/>
-
-    <meta name="distribution" content="global"/>
-    <meta name="resource-type" content="document"/>
-
-    <meta name="robots" content="nofollow"/>
-    <meta name="copyright" content="Copyright 2007 WSO2"/>
-
-    <meta name="mssmarttagspreventparsing" content="true"/>
-    <meta http-equiv="imagetoolbar" content="no"/>
-
-    <!-- If the serviceURL changed other than axis2/services
-                  following two links should be chnaged to copewith new serviceURL
-                  foo/bar/rss and foo/bar/atom
-             -->
-
-    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="#"
-          onclick="javascript:openWindow('rss');return false;"/>
-    <link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="#"
-          onclick="javascript:openWindow('atom');return false;"/>
-    <link rel="shortcut icon" href="favicon.ico" type="image/ico"/>
-    <!-- ####################################################################### -->
-    <!--                  Place Holder for CSS File References                   -->
-    <!-- ####################################################################### -->
-    <!--<link rel="stylesheet" type="text/css" href="css/main.css" media="screen, projection" />-->
-
-    <link rel="stylesheet" type="text/css" href="css/tabs.css">
-    <link rel="stylesheet" type="text/css" href="css/widgets.css">
-    <link rel="stylesheet" type="text/css" href="css/mashups-list.css">
-    <link rel="stylesheet" type="text/css" href="css/container.css">
-    <link rel="stylesheet" type="text/css" href="css/mashup-main.css">
-    <link rel="stylesheet" type="text/css" href="js/yui/tabview/assets/tabview.css">
-    <link rel="stylesheet" type="text/css" href="js/yui/tabview/assets/border_tabs.css">
-    <link type="text/css" rel="stylesheet" href="css/reset-fonts-grids.css">
-    <link rel="stylesheet" type="text/css" href="css/round_tabs.css">
-
-
-    <!-- ####################################################################### -->
-    <!--               Place Holder for Javascript File References               -->
-    <!-- ####################################################################### -->
-       <script type="text/javascript" src="js/yui/yahoo/yahoo.js"></script>
-		<script type="text/javascript" src="js/yui/event/event.js"></script>
-		<script type="text/javascript" src="js/yui/dom/dom.js"></script>
-
-		<script type="text/javascript" src="js/yui/dragdrop/dragdrop.js"></script>
-
-    <script type="text/javascript" src="js/yui/container/container.js"></script>
-    <script type="text/javascript" src="js/yui/connection/connection.js"></script>
-
-
+<title>WSO2 Mashup Server v at mashup_version@ Management Console</title>
 
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
 
+<meta name="description" content="WSO2 Mashup Server v at mashup_version@"/>
 
+<meta name="distribution" content="global"/>
+<meta name="resource-type" content="document"/>
 
+<meta name="robots" content="nofollow"/>
+<meta name="copyright" content="Copyright 2007 WSO2"/>
+
+<meta name="mssmarttagspreventparsing" content="true"/>
+<meta http-equiv="imagetoolbar" content="no"/>
+
+<!-- If the serviceURL changed other than axis2/services
+     following two links should be chnaged to copewith new serviceURL
+     foo/bar/rss and foo/bar/atom
+-->
+
+<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="#"
+      onclick="javascript:openWindow('rss');return false;"/>
+<link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="#"
+      onclick="javascript:openWindow('atom');return false;"/>
+<link rel="shortcut icon" href="favicon.ico" type="image/ico"/>
+<!-- ####################################################################### -->
+<!--                  Place Holder for CSS File References                   -->
+<!-- ####################################################################### -->
+<!--<link rel="stylesheet" type="text/css" href="css/main.css" media="screen, projection" />-->
+
+<link rel="stylesheet" type="text/css" href="css/tabs.css">
+<link rel="stylesheet" type="text/css" href="css/widgets.css">
+<link rel="stylesheet" type="text/css" href="css/mashups-list.css">
+<link rel="stylesheet" type="text/css" href="css/container.css">
+<link rel="stylesheet" type="text/css" href="css/mashup-main.css">
+<link rel="stylesheet" type="text/css" href="js/yui/tabview/assets/tabview.css">
+<link rel="stylesheet" type="text/css" href="js/yui/tabview/assets/border_tabs.css">
+<link type="text/css" rel="stylesheet" href="css/reset-fonts-grids.css">
+<link rel="stylesheet" type="text/css" href="css/round_tabs.css">
+
+
+<!-- ####################################################################### -->
+<!--               Place Holder for Javascript File References               -->
+<!-- ####################################################################### -->
+<script type="text/javascript" src="js/yui/yahoo/yahoo.js"></script>
+<script type="text/javascript" src="js/yui/event/event.js"></script>
+<script type="text/javascript" src="js/yui/dom/dom.js"></script>
+<script type="text/javascript" src="js/yui/dragdrop/dragdrop.js"></script>
+<script type="text/javascript" src="js/yui/container/container.js"></script>
+<script type="text/javascript" src="js/yui/connection/connection.js"></script>
+
+<!--from WSAS Admin UI-->
+<script type="text/javascript" src="../wsasadmin/global_params.js"></script>
+<script type="text/javascript" src="../wsasadmin/js/main.js"></script>
+
+<script type="text/javascript" src="js/wso2/WSRequest.js"></script>
+<script type="text/javascript" src="js/wso2/mashup-main.js"></script>
+<script type="text/javascript" src="js/wso2/services.js"></script>
+<script type="text/javascript" src="js/wso2/mashup.js"></script>
+<script type="text/javascript" src="js/wso2/mashup-utils.js"></script>
+
+
+
+
+<script language="JavaScript1.4" type="text/javascript">
+    YAHOO.namespace("example.container");
+
+    function init() {
+
+        // Define various event handlers for Dialog
+        var handleSubmit = function() {
+            this.submit();
+        };
+        var handleCancel = function() {
+            this.cancel();
+        };
+        var handleSuccess = function(o) {
+            var response = o.responseText;
+            response = response.split("<!")[0];
+            document.getElementById("resp").innerHTML = response;
+            eval(response);
+        };
+        var handleFailure = function(o) {
+            alert("Submission failed: " + o.status);
+        };
+
+        // Instantiate the Dialog
+        YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
+        { width : "300px",
+            fixedcenter : true,
+            visible : false,
+            constraintoviewport : true,
+            buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
+            { text:"Cancel", handler:handleCancel } ]
+        });
+
+        // Validate the entries in the form to require that both first and last name are entered
+        YAHOO.example.container.dialog1.validate = function() {
+            var data = this.getData();
+            if (data.txtname == "" || data.txtpassword == "") {
+                alert("Please enter your user name and pass word.");
+                return false;
+            } else {
+                return true;
+            }
+        };
+
+        // Wire up the success and failure handlers
+        YAHOO.example.container.dialog1.callback = { success: handleSuccess,failure: handleFailure };
+
+        // Render the Dialog
+        YAHOO.example.container.dialog1.render();
+
+
+    }
+
+    YAHOO.util.Event.addListener(window, "load", init);
+
+</script>
 
-  <script language="JavaScript1.4" type="text/javascript" >
-   YAHOO.namespace("example.container");
+<script language="JavaScript" type="text/javascript">
 
-				function init() {
+    function showMashupDownloadDialog() {
 
-					// Define various event handlers for Dialog
-					var handleSubmit = function() {
-						this.submit();
-					};
-					var handleCancel = function() {
-						this.cancel();
-					};
-					var handleSuccess = function(o) {
-						var response = o.responseText;
-						response = response.split("<!")[0];
-						document.getElementById("resp").innerHTML = response;
-						eval(response);
-					};
-					var handleFailure = function(o) {
-						alert("Submission failed: " + o.status);
-					};
 
-					// Instantiate the Dialog
-					YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
-																				{ width : "300px",
-																				  fixedcenter : true,
-																				  visible : false,
-																				  constraintoviewport : true,
-																				  buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
-																							  { text:"Cancel", handler:handleCancel } ]
-																				 } );
+    }
 
-					// Validate the entries in the form to require that both first and last name are entered
-					YAHOO.example.container.dialog1.validate = function() {
-						var data = this.getData();
-						if (data.txtname == "" || data.txtpassword == "") {
-							alert("Please enter your user name and pass word.");
-							return false;
-						} else {
-							return true;
-						}
-					};
-
-					// Wire up the success and failure handlers
-					YAHOO.example.container.dialog1.callback = { success: handleSuccess,failure: handleFailure };
-
-					// Render the Dialog
-					YAHOO.example.container.dialog1.render();
-
-
-				}
-
-				YAHOO.util.Event.addListener(window, "load", init);
-
-  </script>
+</script>
 
 
 </head>
 
 <body>
-<div id="wrapper"><!-- wrapper -->
-
-     <div id="header">
-    <div id="title"><img src="images/siteID.jpg"/></div>
-    <div id="mashup-header">
-        <div id="links">
-            <img src="images/wso2_mashup_logo.gif" align="right"/>
-            <br/><br/><br/>
+<div id="content"><!-- wrapper -->
 
-            <div id="login-data" style="text-align:right; display:none">
-                <!-- Displays currently logged in user and signout link -->
+    <div id="header">
+        <div id="title"><img src="images/siteID.jpg"/></div>
+        <div id="mashup-header">
+            <div id="links">
+                <img src="images/wso2_mashup_logo.gif" align="right"/>
+                <br/><br/><br/>
+
+                <div id="login-data" style="text-align:right; display:none">
+                    <!-- Displays currently logged in user and signout link -->
+                </div>
             </div>
         </div>
     </div>
-</div>
 
 
     <div class="clearfix" style="margin-top:40px;">
-     <div id="doc3" class="yui-t2"><!-- "doc" here for example only; use any page width -->
+        <div id="doc3" class="yui-t2"><!-- "doc" here for example only; use any page width -->
 
-	<div id="bd">
-		<div id="yui-main">
-			<div class="yui-b">
-				<div class="yui-ge">
-					<div class="yui-u first"  style="padding-top:5px;">
-
-                        <div class="container" style="font-size:10pt; font-weight:bold; padding-bottom:15px;">Service List</div>
-                        <div class="container"><img src="images/download_icon.gif" onclick="YAHOO.example.container.dialog1.show()" align="left" alt="Download" title="Download" style="cursor:pointer;"/><b>Mashup Sharing Service</b> <br>Description....</div>
-                        <div class="container"><p><img src="images/download_icon.gif" onclick="YAHOO.example.container.dialog1.show()" align="left" alt="Download" title="Download" style="cursor:pointer;" /><b>Mashup Server Version Service</b> <br>Description....</p></div>
-                        <div class="container"><p><img src="images/download_icon.gif" onclick="YAHOO.example.container.dialog1.show()" align="left" alt="Download" title="Download" style="cursor:pointer;" /><b>Scraper Service</b> <br>Description....</p></div>
-                        <div class="container"><p><img src="images/download_icon.gif" onclick="YAHOO.example.container.dialog1.show()" align="left" alt="Download" title="Download" style="cursor:pointer;" /><b>Service Mata Data Lister</b> <br>Description....</p></div>
-						
-					</div>
-
-					<div class="yui-u"  style="padding-top:8px;">
-						<div class="wso2-mashuplistitem2" >
-
-            <div class="wso2-mashuplisBoxTitle2">How to share my Masups</div>
-            <div class="wso2-mashuplisBody" style="height:100px;">Description....   </div>
-          </div>
-
-         <div class="wso2-mashuplistitem2">
-            <div class="wso2-mashuplisBoxTitle2">About WSO2 Mashup Server</div>
-            <div class="wso2-mashuplisBody" style="height:100px;">Description....   </div>
-          </div>
-					</div>
-				</div>
-			</div>
-		</div>
-		<div class="yui-b" style="padding-top:15px;">
-			<div class="wso2-mashuplisBox"><!-- Menu --></div>
-
-		</div>
-	</div>
-	
-</div>
+            <div id="bd">
+                <div id="yui-main">
+                    <div class="yui-b">
+                        <div class="yui-ge">
+                            <div class="yui-u first" style="padding-top:5px;">
+
+                                <div class="container" style="font-size:10pt; font-weight:bold; padding-bottom:15px;">
+                                    Service List
+                                </div>
+                                <div class="container"><img src="images/download_icon.gif"
+                                                            onclick="WSO2.MashupUtils.showMashupDownloadingDialog();"
+                                                            align="left" alt="Download" title="Download"
+                                                            style="cursor:pointer;"/><b>Mashup Sharing Service</b> <br>Description....
+                                </div>
+                                <div class="container"><p><img src="images/download_icon.gif"
+                                                               onclick="WSO2.MashupUtils.showMashupDownloadingDialog();"
+                                                               align="left" alt="Download" title="Download"
+                                                               style="cursor:pointer;"/><b>Mashup Server Version
+                                    Service</b> <br>Description....</p></div>
+                                <div class="container"><p><img src="images/download_icon.gif"
+                                                               onclick="WSO2.MashupUtils.showMashupDownloadingDialog();"
+                                                               align="left" alt="Download" title="Download"
+                                                               style="cursor:pointer;"/><b>Scraper Service</b> <br>Description....
+                                </p></div>
+                                <div class="container"><p><img src="images/download_icon.gif"
+                                                               onclick="WSO2.MashupUtils.showMashupDownloadingDialog();"
+                                                               align="left" alt="Download" title="Download"
+                                                               style="cursor:pointer;"/><b>Service Mata Data Lister</b>
+                                    <br>Description....</p></div>
+
+                            </div>
+
+                            <div class="yui-u" style="padding-top:8px;">
+                                <div class="wso2-mashuplistitem2">
+
+                                    <div class="wso2-mashuplisBoxTitle2">How to share my Masups</div>
+                                    <div class="wso2-mashuplisBody" style="height:100px;">Description....</div>
+                                </div>
+
+                                <div class="wso2-mashuplistitem2">
+                                    <div class="wso2-mashuplisBoxTitle2">About WSO2 Mashup Server</div>
+                                    <div class="wso2-mashuplisBody" style="height:100px;">Description....</div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="yui-b" style="padding-top:15px;">
+                    <div class="wso2-mashuplisBox"><!-- Menu --></div>
 
+                </div>
+            </div>
 
-        
+        </div>
 
-  </div>
 
-<div id="dialog1">
-	    <div class="hd">Please enter your information</div>
-	    <div class="bd">
-	        <form method="POST" action="http://developer.yahoo.com/yui/examples/container/assets/post.php">
-	            <label for="ip">Your IP Address: </label><input type="text" style="margin-bottom:2px;" align="right" name="firstname" /><br>
-	            <label for="uname">User Name: </label><img src="images/blank.gif" width="27px;" height="1px;" alt="" /><input type="text" style="margin-bottom:2px;" align="right" name="txtname" /><br>
-	           <label for="pword" >Pass Word: </label><img src="images/blank.gif" width="27px;" height="1px;" alt="" /><input type="password" style="margin-bottom:2px;" align="right" name="txtpassword" /><br>
-
-
-	        </form>
-	    </div>
-	</div>
+    </div>
 
+    <div id="dialog1">
+        <div class="hd">Please enter your information</div>
+        <div class="bd">
+            <form method="POST" action="http://developer.yahoo.com/yui/examples/container/assets/post.php">
+                <label for="ip">Your IP Address: </label><input type="text" style="margin-bottom:2px;" align="right"
+                                                                name="firstname"/><br>
+                <label for="uname">User Name: </label><img src="images/blank.gif" width="27px;" height="1px;"
+                                                           alt=""/><input type="text" style="margin-bottom:2px;"
+                                                                          align="right" name="txtname"/><br>
+                <label for="pword">Pass Word: </label><img src="images/blank.gif" width="27px;" height="1px;"
+                                                           alt=""/><input type="password" style="margin-bottom:2px;"
+                                                                          align="right" name="txtpassword"/><br>
 
 
+            </form>
+        </div>
+    </div>
 
 
     <div id="ft">

Modified: trunk/mashup/java/modules/www/js/wso2/mashup-utils.js
==============================================================================
--- trunk/mashup/java/modules/www/js/wso2/mashup-utils.js	(original)
+++ trunk/mashup/java/modules/www/js/wso2/mashup-utils.js	Mon Jul  2 01:36:19 2007
@@ -475,3 +475,158 @@
 };
 
 
+WSO2.MashupUtils.showMashupDownloadingDialog = function () {
+
+    //Creating the content div
+    var parent = document.createElement("div");
+    parent.setAttribute("id", "MashupDownloadDialog");
+
+    var lblServiceName = document.createElement("label");
+    lblServiceName.appendChild(document.createTextNode("Enter Service Name "));
+    parent.appendChild(lblServiceName);
+
+    parent.appendChild(document.createElement("br"));
+
+    var txtServiceName = document.createElement("input");
+    txtServiceName.setAttribute("type", "text");
+    txtServiceName.setAttribute("id", "txtServiceName");
+    txtServiceName.setAttribute("size", "50");
+    parent.appendChild(txtServiceName);
+
+    parent.appendChild(document.createElement("br"));
+
+    var lblIpAddress = document.createElement("label");
+    lblIpAddress.appendChild(document.createTextNode("Enter your mashup server's address "));
+    parent.appendChild(lblIpAddress);
+
+    parent.appendChild(document.createElement("br"));
+
+    var txtIpAddress = document.createElement("input");
+    txtIpAddress.setAttribute("type", "text");
+    txtIpAddress.setAttribute("id", "txtIpAddress");
+    txtIpAddress.setAttribute("size", "50");
+    parent.appendChild(txtIpAddress);
+
+    parent.appendChild(document.createElement("br"));
+    parent.appendChild(document.createElement("br"));
+
+    var lblStatusMessages = document.createElement("label");
+    lblStatusMessages.setAttribute("id", "lblStatus");
+    parent.appendChild(lblStatusMessages);
+
+
+    YAHOO.util.Event.onContentReady('doc3', function() {
+        // Instantiate the Dialog
+        var browser = WSRequest.util._getBrowser();
+        var serviceSharingDialog = "";
+
+        if (browser == "ie" || browser == "ie7") {
+            serviceSharingDialog = new YAHOO.widget.Dialog("MashupDownloadDialog",
+            {
+                width : "500px",
+                x:YAHOO.util.Dom.getViewportWidth() / 8, //Manual fix for getting rubbish viewport dimensions in IE
+                y:100,
+                draggable:true,
+                visible : false,
+                modal:true,
+                close:false,
+                buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
+                { text:"Close", handler:handleCancel } ]
+            });
+        } else {
+            serviceSharingDialog = new YAHOO.widget.Dialog("MashupDownloadDialog",
+            { width : "500px",
+                fixedcenter : true,
+                draggable:true,
+                visible : false,
+                constraintoviewport : true,
+                modal:true,
+                close:false,
+                buttons : [ { text:"Submit", handler:handleSubmit, isDefault:true },
+                { text:"Close", handler:handleCancel } ]
+            });
+        }
+
+        serviceSharingDialog.setHeader("Download Mashup");
+        serviceSharingDialog.setBody(parent);
+        serviceSharingDialog.render("content");
+        serviceSharingDialog.show();
+
+        // Event handlers for the Dialog
+        function handleSubmit() {
+            //get the remote host
+            var remoteServer = document.getElementById("txtIpAddress").value;
+
+            var labelElement = document.getElementById("lblStatus");
+            
+            var serviceName = document.getElementById("txtServiceName").value;
+
+            if ((WSO2.MashupUtils.trim(serviceName) != "") && (WSO2.MashupUtils.trim(remoteServer) != "")) {
+                labelElement.innerHTML = "";
+                labelElement.appendChild(document.createTextNode("Contacting backend services. Please wait..."));
+                wso2.mashup.services.downloadService(serviceName, remoteServer, submitServiceCallback, labelElement, submitServiceError);
+            }
+            else {
+                labelElement.innerHTML = "";
+                labelElement.appendChild(document.createTextNode("Please enter valid details ..."));
+            }
+
+        }
+
+        function submitServiceCallback() {
+
+            var response ;
+
+            var browser = WSRequest.util._getBrowser();
+            if (browser == "ie" || browser == "ie7") {
+                response = this.req.responseXML.getElementsByTagName("ns:return")[0].firstChild.nodeValue;
+            } else {
+                response = this.req.responseXML.getElementsByTagName("return")[0].firstChild.nodeValue;
+            }
+
+            if (response == "true") {
+                this.params.innerHTML = "";
+                this.params.appendChild(document.createTextNode("The service was successfully downloaded. You can safely close this window."));
+
+            } else {
+                this.params.innerHTML = "";
+                this.params.appendChild(document.createTextNode("Failed to download the service. Please verify the destination address."));
+            }
+        }
+
+        function submitServiceError() {
+
+            var error = this.req.error;
+            if (!error) {
+                this.params.innerHTML = "";
+                this.params.appendChild(document.createTextNode("Failed to download the service. Please refer to system admin for more details."));
+            }
+
+            else if (error.reason.indexOf("Access Denied. Please login first") > -1) {
+                wso2.wsf.Util.alertMessage("Your session has expired.");
+                //Envoking force logout
+                wso2.mashup.services.logout(wso2.mashup.handleLogout);
+            }
+
+            else if (error.detail.indexOf("UnknownHostException") > -1) {
+                this.params.innerHTML = "";
+                this.params.appendChild(document.createTextNode("Failed to download the service. Unknown Host : '" + error.reason + "'"));
+            } else {
+                this.params.innerHTML = "";
+                this.params.appendChild(document.createTextNode("Failed to download the service. " + error.reason));
+            }
+        }
+
+        function handleCancel() {
+            this.cancel();
+            clearDom();
+        }
+
+        function clearDom() {
+            var dialogMask = document.getElementById("MashupDownloadDialog_mask");
+            dialogMask.parentNode.removeChild(dialogMask);
+            var dialogResedue = document.getElementById("MashupDownloadDialog_c");
+            dialogResedue.parentNode.removeChild(dialogResedue);
+        }
+    });
+};

Modified: trunk/mashup/java/modules/www/js/wso2/services.js
==============================================================================
--- trunk/mashup/java/modules/www/js/wso2/services.js	(original)
+++ trunk/mashup/java/modules/www/js/wso2/services.js	Mon Jul  2 01:36:19 2007
@@ -296,13 +296,12 @@
 
 
 /**
- * @description Method used to enable or disable an operation of a given service
- * @method setServiceOperationStatus
+ * @description Method used to save changes done to a service source
+ * @method saveServiceSource
  * @public
  * @static
- * @param {String} serviceName 	Name of the service to retrieve operations
- * @param {String} operationName 	Name of the service operation
- * @param {Boolean} status 	The desired status of the operation
+ * @param {String} serviceName 	Name of the new service
+ * @param {String} modifiedSource 	Ammended source code
  * @param {callback} callBack 	User-defined callback function or object
  * @param {callback} params 	Parameters to be set in the callback
  */
@@ -321,17 +320,42 @@
 };
 
 
+/**
+ * @description Method used to download a mashup from a remote server
+ * @method downloadService
+ * @public
+ * @static
+ * @param {String} serviceName 	Name of the service to download
+ * @param {String} remoteServer 	IP of the remote server
+ * @param {callback} callBack 	User-defined callback function or object
+ * @param {callback} params 	Parameters to be set in the callback
+ * @param {callback} errorCallback 	User-defined error callback function or object
+ */
+wso2.mashup.services.downloadService = function (serviceName, remoteServer, callback, params, errorCallback) {
+
+    var callURL = serverURL + "/" + "ServiceSharingHelper" + "/" ;
+
+    var body_xml = '<req:downloadServiceRequest xmlns:req="http://servicesharinghelper.coreservices.mashup.wso2.org/xsd">\n' +
+                   ' <req:remoteServer>' + remoteServer + '</req:remoteServer>\n' +
+                   ' <req:serviceName>' + serviceName + '</req:serviceName>\n' +
+                   ' </req:downloadServiceRequest>\n';
+
+    new wso2.wsf.WSRequest(callURL, "downloadService", body_xml, callback, params, errorCallback);
+
+};
+
+
 wso2.mashup.services.defaultErrHandler = function () {
 
     var error = this.req.error;
     if (!error) {
         wso2.wsf.Util.alertMessage("Console has received an error. Please refer" +
                                    " to system admin for more details.");
-    }else if (error.reason.indexOf("Access Denied. Please login first") > -1) {
+    } else if (error.reason.indexOf("Access Denied. Please login first") > -1) {
         wso2.wsf.Util.alertMessage("Your session has expired.");
         //Envoking force logout
         wso2.mashup.handleLogout();
-    }else if (error.detail.indexOf("NS_ERROR_NOT_AVAILABLE") > -1) {
+    } else if (error.detail.indexOf("NS_ERROR_NOT_AVAILABLE") > -1) {
         wso2.wsf.Util.alertMessage("Your session has expired.");
         //Envoking force logout
         wso2.mashup.handleLogout();




More information about the Mashup-dev mailing list