I have tried to invoke a wcf service using JAVA Script...
Script code is:
---------------------------
var xmlHttpReq =new ActiveXObject("Microsoft.XMLHTTP");
alert("hai");
//var content = '<?xml version="1.0" encoding="utf-8"?><soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"><soap12:Body><ReverseName xmlns="http://tempuri.org/"><Name>nandha</Name></ReverseName></soap12:Body></soap12:Envelope>';
//<a:Action s:mustUnderstand="1">http://tempuri.org/IFunService/ReverseName</a:Action>
var content= '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo></s:Header><s:Body> <ReverseName xmlns="http://tempuri.org/"><Name>nandha</Name></ReverseName></s:Body></s:Envelope>';
xmlHttpReq.open("POST", "http://s9896/WCFTest/FunService.svc", false);
//xmlHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttpReq.setRequestHeader("Content-Type", "application/soap+xml; charset=utf-8");
xmlHttpReq.setRequestHeader ("SOAPAction", "http://tempuri.org/ReverseName");
xmlHttpReq.setRequestHeader("Content-Length", content.length);
alert(content);
xmlHttpReq.send(content);
alert(xmlHttpReq.responseText);
alert(xmlHttpReq.status);
alert(xmlHttpReq.statusText);
----------------------------
But i got an exception :
------------------------
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header><a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action></s:Header>
<s:Body>
<s:Fault>
<s:Code><s:Value>s:Sender</s:Value><s:Subcode><s:Value xmlns:a="http://schemas.xmlsoap.org/ws/2005/02/sc">a:BadContextToken</s:Value></s:Subcode></s:Code>
<s:Reason><s:Text xml:lang="en-US">
The message could not be processed. This is most likely because the action 'http://www.w3.org/2005/08/addressing/soap/fault' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding .</s:Text></s:Reason>
</s:Fault>
</s:Body>
</s:Envelope>
---------------------------
Am so confused with Security Context Token.. Can any one help me for ths problem?
Regards
Nandha Kumar,