This blog is moved to
http://amalhashim.wordpress.com

Thursday, October 29, 2009

SSRS report and Webservice as datasource

One good feature i found in SSRS report is that, we can provide webservice as the datasource. We can create dataset using webservice methods.

For creating a dataset using webservice, do the following steps.
  • Create a new Datasource
  1. From solution explorer, right click "Shared Data Sources".
  2. Click on "Add new Datasource".
  3. In the new window, provide a name for the new datasource.
  4. Select type as "Xml".
  5. In connection string, provide the path of wsdl. Ex: http://localhost/Service1.asmx?wsdl
  6. Hit Ok.
  • Create a new Dataset
  1. Select the Data tab.
  2. From the Dataset dropdown, select "New Dataset".
  3. In the Dataset window, Select the dataset we have created.
  4. Select Text as command.
  5. Use the following query
<Query>
<Method Namespace="http://tempuri.org/" Name="MethodName">
<Parameters>
<Parameter Name="parameter1">
<DefaultValue>1 </DefaultValue>
</Parameter>
</Parameters>
</Method>
<SoapAction>http://tempuri.org/MethodName </SoapAction>
</Query>

MethodName is the method you want to invoke in the webservice.
parameter1 is the name of the parameter the webservice method is expecting. You need to create a Report Parameter. And in the "Create New Datset" window, open the Parameter tab and add that parameter.

Now in the query window, execute the query by clicking the "Red Exclamation Icon".

Done!!!

For queries and suggestions, please feel free to ping me.

No comments: