Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 How to consume WCF Service in SSRS report

Author  Topic 

dragselect
Starting Member

2 Posts

Posted - 2008-12-10 : 11:25:07
In my web site, I'm using following C# code using WCF Service to pull student address successfully and display it on web page.
Can you list me steps how to use following StudentManager WCF Service in SQL Server Reporting Services (SSRS) report.
I need to display student address on the SSRS report but not sure how to call or consume this WCF serive from SSRS report.
Thanks very much.

public static string GetStudentAddress()
{
//return DateTime.Now;
Student std = GetStudent("AA432");
Label1.Text = std.Address;
}

private static Student GetStudent(string studentID)
{
// Call the StudentManager WCF to load student data.
// StudentService is service reference name when i added it's refernce to my application.
StudentService.StudentMangerServiceClient wcf = new StudentService.StudentServiceClient();
StudentService.StudentPacket sp = wcf.RetrieveRecord(studentID);
return DeserializeData(sp.StudentBytes);
}

private static Student DeserializeData(byte[] studentBytes)
{
using (MemoryStream ms = new MemoryStream(studentBytes))
{
BinaryFormatter bf = new BinaryFormatter();
ms.Seek(0, SeekOrigin.Begin);
return (Student)bf.Deserialize(ms);
}
}
   

- Advertisement -