Hi,
is it possible to call the Reporting Services Web Service with jQuery? If yes, can someone post me a small example?
Background:
My plan is to create a html with a form which is also uploaded then into the reportserver. I open this html later by clicking a link in a report (with gotoURL open.window). The report opens the html inclusive the overtaken of some additional parameters (reportname, reportdescription). These parameters I will use in the html-form as defaultvalues for the corresponding input-text-fields. Now the user can make some changes (i.e. the decription). With a click on a button I will send the new description to the Reporting Services Web Service by using the SetProperties method, closing the html-window and reload the report. Important is that I want to upload the html also into the reportserver itself.
I have already found how to consume a web service via jQuery but with the Reporting Services Web Service I did not get it running in my tests.
I have referenced to the following jQuery.js: http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
Here you can see my tests I made with the results:
$.ajax({ type: 'POST', url: 'http://<..>/ReportServer/ReportService2010.asmx/ListChildren', data: {'ItemPath':'/','Recursive':false}, complete: function(xData, status) { $('p').html($(xData.responseXML).text()); // result $("#divStatus").text( status ); // status } });
I got a NULL response with Status success. But where are the items?
Another test which should response only one value was that:
$.ajax({ type: "POST", contentType: "text/xml; charset=utf-8", url: "http://<..>/ReportServer/ReportService2010.asmx/GetItemType", data: {"Item":"/Development"}, // Development is a Folder in my Reportserver-Root dataType: "xml", success: function (msg) { $("#divResult").html(msg.responseXML); }, error: function (data, status, error) { $("#divResult").html("WebSerivce unreachable<br> <br>" + data.responseXML + "<br> <br>(" + error + ")"); } });
Here I got an [object Error]
And here my last test:
var soapMessage = '<?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>\<GetItemType xmlns="http://www.microsoft.com/sql/ReportingServer">\<ItemPath>/Development</ItemPath>\</GetItemType>\</soap:Body>\</soap:Envelope>'; $.ajax({ type: "POST", contentType: "text/xml; charset=utf-8", url: http://<..>/ReportServer/ReportService2010.asmx?wsdl, data: soapMessage, dataType: "xml", success: processSuccess, error: processError }); function processSuccess(data, status, req) { if (status == "success") $("#response").text($(req.responseXML).find("Type").text()); } function processError(data, status, req) { alert(req.responseText + " " + status); }
Here I got an "Undefined error"
Can anyone help me?
Thanks
René Illner