Hallo zusammen,
habe als absoluter dummy unteres Script angepasst und zum laufen bekommen. Leider nur auf dem IE. Unter Firefox bekomme ich kein Ergebnis zurückgemeldet. Kann mir jemand helfen bzw. einen Anpassungstip geben, damit das Ganze unter Firefox läuft?
Gruß und Dank
Bernd
HTML
ICOM Soap Test.html
<html>
<head>
<title>ICOM Soap SimpleTest</title>
<style type="text/css">
.style1
{
width: 123px;
}
</style>
</head>
<body>
<script type="text/javascript">
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari, IE>=7.0
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer < 7.0
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
}
}
}
return xmlHttp;
}
function stateChanged()
{
if (xmlHttp.readyState==4) {
document.getElementById("txtStatus").innerHTML= "("+xmlHttp.status+") "+
xmlHttp.statusText;
var response= xmlHttp.responseXML.documentElement;
var value= response.getElementsByTagName("value")[0].firstChild.data;
document.getElementById("txtHint").innerHTML= value;
}
}
function GetDP(oid)
{
var xml=
'<?xml version="1.0" encoding="utf-8"?>'
+'<soap:Envelope'
+' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'
+' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
+' xmlns:xsd="http://www.w3.org/2001/XMLSchema">'
+'<soap:Body>'
+'<readDpRequest xmlns="http://ws01.lom.ch/soap/">'
+'<ref xmlns="">'
+'<oid>' + oid + '</oid>'
+'</ref>'
+'<startIndex xmlns="">0</startIndex>'
+'<count xmlns="">-1</count>'
+'</readDpRequest>'
+'</soap:Body>'
+'</soap:Envelope>';
return xml;
}
function showHint(oid, url)
{
document.getElementById("txtStatus").innerHTML= "Status= ...";
document.getElementById("txtHint").innerHTML= "..";
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null) {
return;
}
var soapAction= "http://ws01.lom.ch/soap/readDP";
xmlHttp.onreadystatechange=stateChanged;
var sRequestBody;
sRequestBody= GetDP(oid);
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttp.setRequestHeader("SOAPAction", soapAction);
xmlHttp.send(sRequestBody);
}
</script>
<h3>ICOM einfacher WebService-Test mit AJAX</h3>
<p>Wähle ein Service aus der untenstehenden Box und drücke die
"Invoke"-Taste</p>
<table>
<tr>
<td class="style1">URL:</td>
<td><input id="URL" name="url" type="text" style="width: 199px"
value="http://192.168.178.200/ws" />
</td>
</tr>
<tr>
<td class="style1">Web Services (readDP(OID)): </td>
<td>
<select id="WebServices" style="width: 199px"
name="WebServices">
<option selected="selected"
value="/1/2/4/3/50/0">DateTime</option>
<option></option>
</select>
<input id="Button1" type="button"
value="Invoke the Web Service"
onclick="showHint(
document.getElementById('WebServices').value,
document.getElementById('url').value)" />
</td>
</tr>
</table>
<hr />
<table>
<tr>
<td class="style1">Response:</td>
</tr>
<tr>
<td>HTTP Status:</td>
<td><span id="txtStatus"></td>
</tr>
<tr>
<td>SOAP Resp:</td>
<td><span id="txtHint"></td>
</tr>
</table>
</body>
</html>
Alles anzeigen