Soap beginnings
just the start of a soap service call
HTML
<script src="https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js"></script>
<input type=button id="theButton" value="run test" class="runButton">
<div id="log" class="log"></div>
CSS
.runButton {
width: 125px;
margin: 20px;
}
.log {
padding:10px;
margin: 20px;
border: 1px dotted #ccc;
color:#888;
font-face: arial;
font-size:12px;
background: #fbfbfb;
}
JavaScript
function runTest() {
log("thanks");
soap();
}
function soap() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', 'https://servizi-pp.cabel.it/CBL-MITO7-B2B/ControlliCruscotto?wsdl');
// build SOAP request
var sr =
'<?xml version="1.0" encoding="utf-8"?>' +
'<soapenv:Envelope ' +
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
'xmlns:api="http://127.0.0.1/Integrics/Enswitch/API" ' +
'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' +
'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">' +
'<soapenv:Body>' +
'<ser:caricaConnessioni/>' +
'</soapenv:Body>' +
'</soapenv:Envelope>';
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
alert('done use firebug to see response');
}
}
}
// Send the POST request
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.send(sr);
// send request
// ...
}
/* ************************************
_____ ___ __ __ ___ _ _ _____ ___
|_ _| __| \/ | _ \ | /_\_ _| __|
| | | _|| |\/| | _/ |__ / _ \| | | _|
|_| |___|_| |_|_| |____/_/ \_\_| |___|
************************************ */
function log(message, value) {
var outMessage = message;
if (typeof value !== "undefined" && value !== null) {
outMessage += " [" + value + "]";
}
if ($("#log").html() != "") {
$("#log").append("<br>");
}
$("#log").append(outMessage);
if (window.console && console.log) {
console.log(outMessage);
...