Showing posts with label webservice. Show all posts
Showing posts with label webservice. Show all posts

Friday, March 30, 2012

How to create report using WebService as DataSource.

Hi,

We created a simple web serivce having a Web Method which accepts a string parameter and returns "Hello World" concatenated with parameter value. We tested this web service by browsing it through IE and it was working fine by accepting a parameter and displaying the "Hello World " concated with the value given through the parameter when clicked on "Invoke" button.

We now created a Reporting Services 2005 project using BI having a report for which the data source will be the web service which is mentioned above. We defined a parameter for the report which will pass the value to the webservice and the report will display the returned value from the web service.

When we have done the report and executed by giving a value to the parameter and clicking on view report button it was displaying the "Hello World" but the parameter which we passed to the web service is not getting concatenated. When we tried to trace the application we could see that the value passed to the web service web method was comming as null. So kindly help me where I went wrong in developing such a kind of report which is not passing a parmeter to webservice.

Kindly provide us the solution in order to make this issue to be resolved.

Thanks in Advance.I can concur with VDeevi, I was able to recreate the exact same issue. In my case I'm passing parameters to a web service that is returning a dataset. When I set a default value in the webmethod it returns a dataset successfully. My problem is also that the parameters are not getting passed to the web service.

What I think is strange is that I've done the BOL sample with the SSRS web service Listchildren method and it works successfully. Does that mean that the problem is not in SSRS but in my implementation of the web service?

This works:



<WebMethod()> _
Public Function GetTestDataset() As System.Xml.XmlElement
Dim TestXDataset As New TestXDataset()
TestXDataset.Fill(1)
Dim xdd As System.Xml.XmlDataDocument = New System.Xml.XmlDataDocument(TestXDataset)
Dim docElem As System.Xml.XmlElement = xdd.DocumentElement
Return docElem
End Function

This doesn't work:



<WebMethod()> _
Public Function GetTestDataset(ByVal ID As Integer) As System.Xml.XmlElement
Dim TestXDataset As New TestXDataset()
TestXDataset.Fill(ID)
Dim xdd As System.Xml.XmlDataDocument = New System.Xml.XmlDataDocument(TestXDataset)
Dim docElem As System.Xml.XmlElement = xdd.DocumentElement
Return docElem
End Function

|||

It's probably not your implementation, but in the parsing specifics of the SoapAction and Namespace.

For example, if your SoapAction is http://tempuri.org/HelloMyNameIs, we split it into http://tempuri.org and HelloMyNameIs throwing away the separating / character.

But if you look at the way webservice is defined, the namespace is actually http://tempuri.org/ - with a trailing /.

So in this case, when method name/namespace can not be correctly derived from SoapAction and when SoapAction can not be correctly derived from method name (in the above case we would get http://tempuri.org//HelloMyNameIs) you should use both <Method …/> and <SoapAction …/>, e.g.

<Query>
<Method Namespace="http://tempuri.org/" Name="HelloMyNameIs"/>
<SoapAction>http://tempuri.org/HelloMyNameIs</SoapAction>
</Query>

We are working on updates to the documentation.

|||Thanks Brain, it really helped us to solve this issue.

Thanks once again,|||Worked for me as well. Thanks a lot!

Monday, March 26, 2012

how to create Extended procdure to invoke a webservice with C#

Hi,
Can anyone help me in creating an Extended procdure that can invoke a webservice with C#.
So, I don't know if you want to create an extended proc in C# calling a web-service or if you want to create an extebded proc calling a C# web service.

Anyway, if the former - you can't. Extended stored procs can only be created using C/C++. If the latter, then Books On Line have some documentation of how to do it.

However, if you use SQL 2005 you should not have to use extended stored procedures, you can write your code using C# (or any .NET language) and create the code as "normal" stored procs.

Niels
|||You should also consider using SQL Server Integration Services since it has built-in adapters to deal with all sorts of data. You can easily integrate that into your application rather than coding your own proc also.|||Hi,
Thanks for u r valuable suggestions Big Smile. Actually i wanted to call C# web service from a stored procedure. I dont know much about Integration services...will study it for sure. As of now, i call a vb method from the stored procedure using sp_oamethod. Then vb dll calls the C#dll which inturn frames the object and invokes the webservice. so i have just used vb as contact point between stored proc and the c# dll...
Pls post ur valuable suggestions on my work around.

-GSM|||If you are using SQL 2005 you can now write VB.NET/C# code which runs inside the database so you don't have to go through sp_OAxxxx.

Niels
|||Hi,
sorry mate...i cannot use sql 2005 and im restricted with sql 2000 only, unfortunately :(. Now im trying to know how to return object or array using sp_OAMethod. Pls post...if u have examples that explains the sp_OAMethod returning object or array. Thank You....

-GSMsql

how to create Extended procdure to invoke a webservice with C#

Hi,
Can anyone help me in creating an Extended procdure that can invoke a webservice with C#.So, I don't know if you want to create an extended proc in C# calling a web-service or if you want to create an extebded proc calling a C# web service.

Anyway, if the former - you can't. Extended stored procs can only be created using C/C++. If the latter, then Books On Line have some documentation of how to do it.

However, if you use SQL 2005 you should not have to use extended stored procedures, you can write your code using C# (or any .NET language) and create the code as "normal" stored procs.

Niels|||You should also consider using SQL Server Integration Services since it has built-in adapters to deal with all sorts of data. You can easily integrate that into your application rather than coding your own proc also.|||Hi,
Thanks for u r valuable suggestions Big Smile. Actually i wanted to call C# web service from a stored procedure. I dont know much about Integration services...will study it for sure. As of now, i call a vb method from the stored procedure using sp_oamethod. Then vb dll calls the C#dll which inturn frames the object and invokes the webservice. so i have just used vb as contact point between stored proc and the c# dll...
Pls post ur valuable suggestions on my work around.

-GSM|||If you are using SQL 2005 you can now write VB.NET/C# code which runs inside the database so you don't have to go through sp_OAxxxx.

Niels|||Hi,
sorry mate...i cannot use sql 2005 and im restricted with sql 2000 only, unfortunately :(. Now im trying to know how to return object or array using sp_OAMethod. Pls post...if u have examples that explains the sp_OAMethod returning object or array. Thank You....

-GSM