var _connectionObject = new XMLHttpRequest();
_connectionObject.onreadystatechange = _xht_StateChange;
_connectionObject.open("POST", url, true);
_connectionObject.send(xmlBody.toString()); // <-- Send the xmlBody string
var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
} catch (E) {
xmlhttp=false
}
}
@else
xmlhttp=false
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false
}
}
<head>
<script src='xmlhttpreq.js'></script
<script>
function xmit(data){
xmlhttp.open("POST", "url/server.php",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.getElementById("sushi").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.setRequestHeader("Man", "GET url/server.php HTTP/1.1")
xmlhttp.setRequestHeader("MessageType", "CALL")
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8")
// xmlhttp.setRequestHeader("SOAPAction", "url/server.php")
xmlhttp.send(
"<"+"?xml version ='1.0' encoding ='UTF-8' ?"+">\n " +
"<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns1='urn:localhost-temperature'"+ "xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:SOAP-"+
"ENC='http://schemas.xmlsoap.org/soap/encoding/' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>"+
"<SOAP-ENV:Body>"+
"<ns1:getTemp>"+
"<symbol xsi:type='xsd:string'>data</symbol>"+
"</ns1:getTemp>"+
"</SOAP-ENV:Body>"+
"</SOAP-ENV:Envelope>"
);
}
</script>
</head>
<body>
<input type='text' id='seg'>
<input type='button' onclick='xmit(document.getElementById("seg").value)' name='' value ='test'>
<div id='sushi'></div>
</body>
<?php
// this is for debugging, as it is hard to do it
$fp = fopen("trace_data.txt", "w+");
fwrite($fp, "[". $HTTP_RAW_POST_DATA . "]\n". print_r($GLOBALS, true));
fclose($fp);
// end debugging
function getTemp($zip) {
global $f;
$temp = rand(40,80);
return $temp;
}
$server = new SoapServer("temperature.wsdl");
$server->addFunction("getTemp");
$server->handle();
?>
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='Temperature'
targetNamespace='http://example.org/temperature'
xmlns:tns=' http://example.org/temperature '
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<message name='getTempRequest'>
<part name='symbol' type='xsd:string'/>
</message>
<message name='getTempResponse'>
<part name='Result' type='xsd:string'/>
</message>
<portType name='TempPortType'>
<operation name='getTemp'>
<input message='tns:getTempRequest'/>
<output message='tns:getTempResponse'/>
</operation>
</portType>
<binding name='TempBinding' type='tns:TempPortType'>
<soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getTemp'>
<soap:operation soapAction='urn:localhost-temperature#getTemp'/>
<input>
<soap:body use='encoded' namespace='urn:localhost-temperature'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:localhost-temperature'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>
<service name='TemperatureService'>
<port name='TempPort' binding='TempBinding'>
<soap:address location='http://www.umweg.ch/soap/server.php'/>
</port>
</service>
</definitions>
<script src='xmlhttpreq.js'></script
<script>
function xmit(data){
xmlhttp.open("POST", "url/server2.php",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.getElementById("sushi").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.setRequestHeader("Man", "GET url/server2.php?data="+data+" HTTP/1.1")
xmlhttp.send("");
}
</script>
<?php
import_request_variables("gp", "d_");
echo $d_data;
?>
This topic is archived.