Advertisement
Guest User

SOAP Client

a guest
Mar 31st, 2015
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.  
  3. <script type="text/javascript">
  4.    
  5.     function run(){
  6.  
  7.         var objXMLHttpRequest = new XMLHttpRequest();
  8.         objXMLHttpRequest.open("GET", "http://localhost:8080/CrunchifyWS/services/CrunchifyHelloWorld?wdsl/", true);
  9.         objXMLHttpRequest.onreadystatechange = function () {
  10.         alert(objXMLHttpRequest.readyState+"   "+ objXMLHttpRequest.status);
  11.         if (objXMLHttpRequest.readyState == 4 && objXMLHttpRequest.status == 200) {
  12.             result = objXMLHttpRequest.responseXML;
  13.           }
  14.         }
  15.         objXMLHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
  16.  
  17.         var packet = '<?xml version="1.0" encoding="utf-8" ?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body> <PieTable xmlns="[getTextResponse(Namespace = "http://service.web.com.crunchify/")]"> <table>Pie</table> </PieTable> </soap:Body></soap:Envelope>';
  18.  
  19.         objXMLHttpRequest.send(packet);
  20.         // Add mentioned below code only if your application calls webservice synchronously. Otherwise use "onreadystatechange" process response.
  21.         response = objXMLHttpRequest.responseXML;
  22.         alert(objXMLHttpRequest.responseText+ "  "+ response);
  23.     }
  24. </script>
  25.  
  26. <head>
  27. </head>
  28. <body>
  29.     <button  onclick="run()">Dale!</button>
  30. </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement