<!DOCTYPE html><html xmlns:s><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(){
jQuery.support.cors = true;
var soapData = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">' + '<s:Body><GetData xmlns="http://tempuri.org/"><value>500</value></GetData></s:Body></s:Envelope>';
$.ajax({
type: "POST",
contentType: "text/xml; charset=utf-8",
dataType: "xml",
url: "http://localhost:61373/Service1.svc",
data: soapData,
beforeSend: function (xhr) {
xhr.setRequestHeader("SOAPAction", "http://tempuri.org/IService1/GetData");
},
success: RetrieveCallbackSuccess,
error: RetrieveCallbackError
});
});
function RetrieveCallbackSuccess(response) { alert("Yey! :) --> " + response.text); }
function RetrieveCallbackError(err) { alert("Onoz! :( --> " + err.statusText); }
});
</script>
</head><body>
<button>tset</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(){
jQuery.support.cors = true;
var soapData = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">' + '<s:Body><GetData xmlns="http://tempuri.org/"><value>500</value></GetData></s:Body></s:Envelope>';
$.ajax({
type: "POST",
contentType: "text/xml; charset=utf-8",
dataType: "xml",
url: "http://localhost:61373/Service1.svc",
data: soapData,
beforeSend: function (xhr) {
xhr.setRequestHeader("SOAPAction", "http://tempuri.org/IService1/GetData");
},
success: RetrieveCallbackSuccess,
error: RetrieveCallbackError
});
});
function RetrieveCallbackSuccess(response) { alert("Yey! :) --> " + response.text); }
function RetrieveCallbackError(err) { alert("Onoz! :( --> " + err.statusText); }
});
</script>
</head><body>
<button>tset</button>
</body></html>
WCF Service
No comments:
Post a Comment