Hello all im trying to consume a web service using javascript and soap but i cant seem to figure out how to getthe response,
Any help with this is greatly appreciated im at a loss on it
Here's what the soap response looks like
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap12=" <soap12:Body>
<hintResponse xmlns=" <hintResult>string</hintResult>
</hintResponse>
</soap12:Body>
</soap12:Envelope>
Here's the Code
<script type="text/javascript" language=javascript>
var xmlHttp;
var strEnvelope = "<?xml version='1.0' encoding='utf-8'?>"+
" <soap12:Envelope xmlns:xsi=' +
" xmlns:xsd=' +
" xmlns:soap12=' +
" <soap12:Body>" +
" <hint xmlns=' +
" <Term>b</Term></hint>" +
" </soap12:Body>" +
"</soap12:Envelope>";
function showHint(str)
{
if (str.length > 0)
{
var url="xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
xmlHttp.open('POST', url , true);
xmlHttp.setRequestHeader("Content-Type","application/soap+xml; charset=utf-8")
xmlHttp.send(strEnvelope);
xmlHttp.onreadystatechange = checkState;
}
}
function checkState(){
if(xmlHttp.readyState=="complete"||xmlHttp.readyState==4){
placeHint(xmlHttp.responseXML);
}
else{
alert("Not Complete");
}
}
function placeHint(xmlresponse) {
alert(xmlresponse);
response = xmlresponse.documentElement;
method = response.getElementsByTagName('hintResponse')[0].firstChild.data;
result = response.getElementsByTagName('hintResult')[0].firstChild.data;
}
</script>
I receive [object] in the alert inside of the placeHint function but then receive the error that response is null or not an object. Im not even sure if this is the best method for getting the data. Like i said id appreciate any insight
<% ASP Web App Development %>
Any help with this is greatly appreciated im at a loss on it
Here's what the soap response looks like
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap12=" <soap12:Body>
<hintResponse xmlns=" <hintResult>string</hintResult>
</hintResponse>
</soap12:Body>
</soap12:Envelope>
Here's the Code
<script type="text/javascript" language=javascript>
var xmlHttp;
var strEnvelope = "<?xml version='1.0' encoding='utf-8'?>"+
" <soap12:Envelope xmlns:xsi=' +
" xmlns:xsd=' +
" xmlns:soap12=' +
" <soap12:Body>" +
" <hint xmlns=' +
" <Term>b</Term></hint>" +
" </soap12:Body>" +
"</soap12:Envelope>";
function showHint(str)
{
if (str.length > 0)
{
var url="xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
xmlHttp.open('POST', url , true);
xmlHttp.setRequestHeader("Content-Type","application/soap+xml; charset=utf-8")
xmlHttp.send(strEnvelope);
xmlHttp.onreadystatechange = checkState;
}
}
function checkState(){
if(xmlHttp.readyState=="complete"||xmlHttp.readyState==4){
placeHint(xmlHttp.responseXML);
}
else{
alert("Not Complete");
}
}
function placeHint(xmlresponse) {
alert(xmlresponse);
response = xmlresponse.documentElement;
method = response.getElementsByTagName('hintResponse')[0].firstChild.data;
result = response.getElementsByTagName('hintResult')[0].firstChild.data;
}
</script>
I receive [object] in the alert inside of the placeHint function but then receive the error that response is null or not an object. Im not even sure if this is the best method for getting the data. Like i said id appreciate any insight
<% ASP Web App Development %>