<!DOCTYPE html><html xmlns:soap><head>
<script type="text/JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
//Called this method on any button click event for Testing
$(document).ready(function(){
$("button").click(function(){
var soapRequest="<?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>"+
"<GetData xmlns=\'http://tempuri.org/\'>"+
"<value>500</value>"+
"</GetData>"+
" </soap:Body>"+
"</soap:Envelope>";
var xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
xmlHttp.open("post","http://localhost:61373/Service1.svc", false);
xmlHttp.setRequestHeader("Content-Type","text/xml; charset=utf-8");
xmlHttp.setRequestHeader("Content-Length", soapRequest.length);
xmlHttp.setRequestHeader("SOAPAction","http://tempuri.org/IService1/GetData ");
xmlHttp.send(soapRequest);
var responseXML=xmlHttp.responseXML;
alert(responseXML.text);
});
});
</script>
</head><body>
<button>test</button>
</body></html>
WCF SERVICE
<script type="text/JavaScript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
//Called this method on any button click event for Testing
$(document).ready(function(){
$("button").click(function(){
var soapRequest="<?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>"+
"<GetData xmlns=\'http://tempuri.org/\'>"+
"<value>500</value>"+
"</GetData>"+
" </soap:Body>"+
"</soap:Envelope>";
var xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
xmlHttp.open("post","http://localhost:61373/Service1.svc", false);
xmlHttp.setRequestHeader("Content-Type","text/xml; charset=utf-8");
xmlHttp.setRequestHeader("Content-Length", soapRequest.length);
xmlHttp.setRequestHeader("SOAPAction","http://tempuri.org/IService1/GetData ");
xmlHttp.send(soapRequest);
var responseXML=xmlHttp.responseXML;
alert(responseXML.text);
});
});
</script>
</head><body>
<button>test</button>
</body></html>
WCF SERVICE
No comments:
Post a Comment