I have an SSRS 2005 report which I'd like to use a webservice to retrieve some data. This webservice will take in several parameters.
As a test I set up a very simple demo webservice project on my local environment:
[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Service : System.Web.Services.WebService { public Service () {} [WebMethod] public int DivideByTwo(int numberIn) { return numberIn/2; } }
My test report then has a Dataset using an XML datasource, with the (localhost) URL of the webservice in the connection string.
In the query string of the dataset I have the following, based on MS documentation (http://msdn.microsoft.com/en-us/library/aa964129(SQL.90).aspx):
<Query> <SoapAction>http://tempuri.org/DivideByTwo</SoapAction> <Method Namespace="http://tempuri.org/" Name="DivideByTwo" /> <Parameters> <Parameter Name="NumberIn"> <DefaultValue>100</DefaultValue> </Parameter> </Parameters> <ElementPath IgnoreNamespaces="True">*</ElementPath> </Query>
The problem I'm having is that, despite the webservice being triggered, the parameter is not getting passed to the webservice and consequently the return value is always 0. I've debugged the webservice and placed a breakpoint in the DivideByTwo() method, and when the webservice call is triggered from the report and the breakpoint is hit, the numberIn value is always 0 regardless of what I place in the element of the Query XML.
I've also tried specifying the "NumberIn" parameter in the "Parameters" tab of the Dataset dialog box (with a supplied value) and removing the element from the query XML - the result is the same.
I've found some posts on the web outlining the same issue but can't seem to find a solution, and have been tearing my hair out for the last couple of hours. Any help would be much appreciated.
As DavveK mentioned, it looks like it's a simple typo with the capitalization of your parameter.
Your service definition is looking for:
numberIn
while your XML DataSet provides:
NumberIn
As the article you referenced mentions, paramaters are case-sensitive. See #8 at http://msdn.microsoft.com/en-us/library/aa964129(SQL.90).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With