You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/09/29 11:16:25 UTC

svn commit: r451184 - in /incubator/servicemix/trunk/samples: bridge/client.html wsdl-first/client.html

Author: gnodet
Date: Fri Sep 29 02:16:24 2006
New Revision: 451184

URL: http://svn.apache.org/viewvc?view=rev&rev=451184
Log:
SM-599: bridge sample client.html providing no status info
Thanks Georg for the patch.
Patch also applied to wsdl-first example

Modified:
    incubator/servicemix/trunk/samples/bridge/client.html
    incubator/servicemix/trunk/samples/wsdl-first/client.html

Modified: incubator/servicemix/trunk/samples/bridge/client.html
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/bridge/client.html?view=diff&rev=451184&r1=451183&r2=451184
==============================================================================
--- incubator/servicemix/trunk/samples/bridge/client.html (original)
+++ incubator/servicemix/trunk/samples/bridge/client.html Fri Sep 29 02:16:24 2006
@@ -19,8 +19,9 @@
 <!-- $Rev: 356052 $ $Date: 2005-12-11 14:41:20 -0800 (dim., 11 dv©c. 2005) $ -->
 <html>
 <head>
-<title>ServiceMix SOAP Binding Example</title>
+<title>ServiceMix Bridge Example</title>
 <script type="text/javascript">
+var urlToOpen = "http://localhost:8192/bridge/"; //default URL to open
 
 function getHTTPObject() {
   var xmlhttp = false;
@@ -55,7 +56,13 @@
      xmlhttp.onreadystatechange=function() {
         if (xmlhttp.readyState == 4) { /* 4 : état "complete" */
            var response = document.getElementById("response");
-           response.value = "STATUS: " + xmlhttp.status + "\n" + xmlhttp.responseText
+           var responseStatus = "";
+           try {
+             responseStatus = xmlhttp.status + "";
+           } catch (e) {
+             responseStatus = "ERROR WHILE RETRIEVING STATUS; MAYBE UNABLE TO CONNECT.";
+           }
+           response.value = "STATUS: " + responseStatus + "\n" + xmlhttp.responseText;
         }
      }
   }
@@ -63,18 +70,22 @@
 }
 
 function send() {
+  if ((document.getElementById("urlToOpen").value != urlToOpen) && (document.getElementById("urlToOpen").value != "")) {
+    //use user entry only if it at least can be okay
+    urlToOpen = document.getElementById("urlToOpen").value;
+  }  
   var xmlhttp = getHTTPObject();
   if (!xmlhttp) {
     alert('cound not create XMLHttpRequest object');
     return;
   }
   var request = document.getElementById("request");
-  var response = document.getElementById("response");
+  var response = document.getElementById("response");  
   try {
     netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead UniversalBrowserWrite");
-    xmlhttp.open("POST", "http://localhost:8192/bridge/", true);
+    xmlhttp.open("POST", urlToOpen, true);
   } catch (e) {
-    alert('error opening');
+    alert('Error opening connection');
   }
   xmlhttp.send(request.value);
 }
@@ -84,11 +95,13 @@
 
 <body>
 
-<h1>ServiceMix SOAP Binding Example</h1>
+<h1>ServiceMix Bridge Example</h1>
 
-<p>Welcome to the soap binding example for ServiceMix</p>
+<p>Welcome to the Bridge example for ServiceMix.</p>
+
+<p>Perform a POST into the HTTP binding. This requires JavaScript.</p> 
+<p>Target: <input type="text" size="50" id="urlToOpen" value=""><script type="text/javascript">document.getElementById("urlToOpen").value = urlToOpen;</script>.</p>
 
-Perform a POST into the HTTP binding <p>
 
 <table>
   <tr>

Modified: incubator/servicemix/trunk/samples/wsdl-first/client.html
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/samples/wsdl-first/client.html?view=diff&rev=451184&r1=451183&r2=451184
==============================================================================
--- incubator/servicemix/trunk/samples/wsdl-first/client.html (original)
+++ incubator/servicemix/trunk/samples/wsdl-first/client.html Fri Sep 29 02:16:24 2006
@@ -19,8 +19,9 @@
 <!-- $Rev: 356052 $ $Date: 2005-12-11 14:41:20 -0800 (dim., 11 dv©c. 2005) $ -->
 <html>
 <head>
-<title>ServiceMix SOAP Binding Example</title>
+<title>ServiceMix WSDL-First Example</title>
 <script type="text/javascript">
+var urlToOpen = "http://localhost:8192/PersonService/"; //default URL to open
 
 function getHTTPObject() {
   var xmlhttp = false;
@@ -55,7 +56,13 @@
      xmlhttp.onreadystatechange=function() {
         if (xmlhttp.readyState == 4) { /* 4 : état "complete" */
            var response = document.getElementById("response");
-           response.value = "STATUS: " + xmlhttp.status + "\n" + xmlhttp.responseText
+           var responseStatus = "";
+           try {
+             responseStatus = xmlhttp.status + "";
+           } catch (e) {
+             responseStatus = "ERROR WHILE RETRIEVING STATUS; MAYBE UNABLE TO CONNECT.";
+           }
+           response.value = "STATUS: " + responseStatus + "\n" + xmlhttp.responseText;
         }
      }
   }
@@ -63,6 +70,10 @@
 }
 
 function send() {
+  if ((document.getElementById("urlToOpen").value != urlToOpen) && (document.getElementById("urlToOpen").value != "")) {
+    //use user entry only if it at least can be okay
+    urlToOpen = document.getElementById("urlToOpen").value;
+  }  
   var xmlhttp = getHTTPObject();
   if (!xmlhttp) {
     alert('cound not create XMLHttpRequest object');
@@ -72,7 +83,7 @@
   var response = document.getElementById("response");
   try {
     netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead UniversalBrowserWrite");
-    xmlhttp.open("POST", "http://localhost:8192/PersonService/", true);
+    xmlhttp.open("POST", urlToOpen, true);
   } catch (e) {
     alert('error opening');
   }
@@ -84,12 +95,13 @@
 
 <body>
 
-<h1>ServiceMix SOAP Binding Example</h1>
+<h1>ServiceMix WSDL-First Example</h1>
 
-<p>Welcome to the soap binding example for ServiceMix</p>
-
-Perform a POST into the HTTP binding <p>
+<p>Welcome to the WSDL-First example for ServiceMix</p>
 
+<p>Perform a POST into the HTTP binding. This requires JavaScript.</p> 
+<p>Target: <input type="text" size="50" id="urlToOpen" value=""><script type="text/javascript">document.getElementById("urlToOpen").value = urlToOpen;</script>.</p>
+  
 <table>
   <tr>
     <td>