Using Web Service as a Data Source in Sql Server Reporting Services

Suppose this is a simple web method inside a web service in ASP.NET.

[WebMethod]

public string HelloWorld(String FirstName, String LastName) {

return “Hello “ + FirstName+ ” “ + LastName ;

}

Now we would to add the above as a xml data source in out Report.

For this we need to do the following

  • Create a new Report
  • Select <New DataSet..>
  • For Type (inside General Tab) select XML as DataSource type.
  • Inside connection string give the path to the web service.
  • i.e. http://localhost:2584/WebSites/Service.asmx
  • Define query for the data source in the following manner

<Query>

<Method Namespace=http://tempuri.org/ Name=HelloWorld>

</Method>

<SoapAction>http://tempuri.org/HelloWorld</SoapAction>

</Query>

 

We can create report parameters for FirstName and LastName parameters of the method.

Or we want to define default values for these parameters define the query as following

 

<Query>

<Method Namespace=http://tempuri.org/ Name=HelloWorld>

<Parameters>

<Parameter Name=FirstName>

<DefaultValue>Nishant</DefaultValue>

</Parameter>

<Parameter Name=LastName>

<DefaultValue>Rana</DefaultValue>

</Parameter>

</Parameters>

</Method>

<SoapAction>http://tempuri.org/HelloWorld</SoapAction>

</Query>

 

Bye..


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

5 thoughts on “Using Web Service as a Data Source in Sql Server Reporting Services”

  1. Is it possible to configure WebService URL for each environment? Because we’ve Lot of environments where we would like to deploy this reports — We use SlowCheetah as well — So, any transformation should also work.

    Like

Share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s