WSS నుండి SSRS వెబ్ సర్వీసెస్ ప్రారంభించడం / FBA లు ఎన్విరాన్మెంట్ MOSS

We needed to invoke the "CreateSubscription" method on an SSRS web service that is hosted in an FBA managed MOSS environment from a custom web part. We kept getting variations of:

  • 401: అధికారం లేదు
  • ఆబ్జెక్ట్ తరలించబడింది

The "object moved" message was most interesting because it was saying that the "object" (మా SSRS సేవ) had "moved" to login.aspx. This clearly meant we had some kind of authentication problem.

I eventually realized that I had bookmarked a blog entry by Robert Garret that described how to invoke a general purpose WSS/MOSS web service living inside an FBA environment. Note that I can’t link directly to the article (యొక్క 06/09/08) because it wants to authenticate. The link I provide brings you to an "all posts" view and you can locate the specific article by searching for "Accessing MOSS Web Services using Forms Based Authentication".

ఇక్కడ మాకు పనిచేసింది కోడ్ వార్తలు:

ReportingService2006 rs = సున్న; 
// Authenticate Authentication auth = కొత్త Authentication(); 
auth.Url = "http://URL/_vti_bin/Authentication.asmx";
auth.CookieContainer =
కొత్త CookieContainer();
LoginResult result = auth.Login("userid", "password");
అయితే (result.ErrorCode == LoginErrorCode.NoError) 
{
// No error, so get the cookies.
CookieCollection cookies = auth.CookieContainer.GetCookies(కొత్త Uri(auth.Url));
Cookie authCookie = cookies[result.CookieName];
rs =
కొత్త ReportingService2006();
rs.Url =
"http://server/_vti_bin/ReportServer/ReportService2006.asmx";
rs.CookieContainer =
కొత్త CookieContainer();
rs.CookieContainer.Add(authCookie);
}
ప్రయత్నించండి
{
  rs.CreateSubscription(report, extSettings, desc, eventType, matchData, parameters1);
}
పట్టుకొను (మినహాయింపు మాజీ)
{
  Console.WriteLine(ex.Message.ToString());
}

I interpret things to work like this:

  • Our web part needs to dial up the authentication service and say, "Hey, Tony, it’s me!".
  • Authentication service replies saying, "Hey, I know you. How are the kids? Here’s a token."
  • We call up the SSRS service and say, "Tony sent me, here’s the token."

</చివర>

నా బ్లాగ్ సబ్స్క్రయిబ్.

ఒక Reply వదిలి

మీ ఇమెయిల్ చిరునామా ప్రచురితమైన కాదు. లు గుర్తించబడతాయి *