you can download the webservice code from here.
you just need to change the site url. for this select project and press F4 then it will show properties window. right click deploy it.
I am consuming this webservice using jquery.
Please this code below this tag
<asp:Content
ContentPlaceHolderId="PlaceHolderMain" runat="server">
Update web
service url and soap message as well.
<script src="/shared%20documents/jquery-1.8.2.min.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready(function () {
alert();
var soapMessage = '<?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>\
<GetSiteListCount xmlns="http://tempuri.org/" />\
</soap12:Body>\
</soap12:Envelope>'
$.ajax({
url: "http://spdev5:8004/_layouts/webservicedemo/mycustomws.asmx?op=GetSiteListCount",
type: "POST",
dataType: "xml",
data: soapMessage,
processData: false,
contentType: "text/xml;
charset=\"utf-8\"",
success: OnSuccess,
error: OnError
});
});
function OnSuccess(data, status) {
alert(data.text);
}
function OnError(request, status, error) {
alert('error' + request + status +
error);
}</script>
No comments:
Post a Comment