Make sure to add script i.e. jquery-2.1.4.min.js
$(document).ready(function () {
$("#btnCallWebService").click(function (event) {
var wsUrl = "http://localhost:8088/mockHello_Binding";
var soapRequest = Enter your SOAP Request. Before trying this if possible make sure that your request is working perfect using tool like SOAPUI.
$(document).ready(function () {
$("#btnCallWebService").click(function (event) {
var wsUrl = "http://localhost:8088/mockHello_Binding";
var soapRequest = Enter your SOAP Request. Before trying this if possible make sure that your request is working perfect using tool like SOAPUI.
$.ajax({
type: "POST",
url: wsUrl,
contentType: "text/xml",
dataType: "xml",
data: soapRequest,
success: processSuccess,
error: processError
});
});
});
function print_r(printthis, returnoutput) {
var output = '';
if($.isArray(printthis) || typeof(printthis) == 'object') {
for(var i in printthis) {
output += i + ' : ' + print_r(printthis[i], true) + '\n';
}
}else {
output += printthis;
}
if(returnoutput && returnoutput == true) {
return output;
}else {
alert(output);
}
}
function processSuccess(data, status, req) {
if (status == "success")
{
alert("hi1");
$("#response").text($(req.responseXML).find("Hello siddharatha").text());
}
}
function processError(data, status, req) {
alert("hi2 data responseText>>>>>>>>>>"+data.responseText);
alert("hi2 data statusText>>>>>>>>>>"+data.statusText);
alert("hi2 data >>>>>>>>>>"+data);
print_r(data);
alert("hi3 status"+status);
alert("hi3 req"+req);
alert(req.responseText + " " + status);
}
and in html body create button with id= btnCallWebService
No comments:
Post a Comment