Invoking SSRS Mga Serbisyo sa Web Mula sa WSS / Moss sa FBA Kapaligiran

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: Hindi awtorisado
  • Bagay Inilipat

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

Ako kalaunan natanto na ako ay nagkaroon -bookmark ng isang 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 (bilang ng 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".

Narito ang code na nagtrabaho para sa amin:

ReportingService2006 rs = sero; 
// Patunayan Authentication auth = bago Pagpapatunay(); 
auth.Url = "http://URL / _vti_bin / Authentication.asmx";
auth.CookieContainer =
bago CookieContainer();
LoginResult resulta = auth.Login("userid", "password");
kung (result.ErrorCode == LoginErrorCode.NoError) 
{
// Walang mga error, kaya makuha ang cookies.
CookieCollection cookies = auth.CookieContainer.GetCookies(bago Uri(auth.Url));
Cookie authCookie = cookies[result.CookieName];
rs =
bago ReportingService2006();
rs.Url =
"http://server/_vti_bin/ReportServer/ReportService2006.asmx";
rs.CookieContainer =
bago CookieContainer();
rs.CookieContainer.Add(authCookie);
}
sumubok
{
  rs.CreateSubscription(mag-ulat, extSettings, DESC, eventType, matchData, parameters1);
}
abutin (Exception hal)
{
  Console.WriteLine(ex.Message.ToString());
}

Ko mabibigyang kahulugan ang mga bagay upang gumana tulad nito:

  • Ang aming web bahagi ay kailangang i-dial up ang authentication serbisyo at sabihin, "Hey, Tony, ito ay sa akin!".
  • Authentication service tugon sinasabi, "Hey, I know you. How are the kids? Here’s a token."
  • Tinatawag namin up ang SSRS serbisyo at sabihin, "Tony sent me, narito ang token."

</dulo>

Mag-subscribe sa aking blog.

-Iwan ng sagot

Ang iyong email address ay hindi nai-publish. Mga kinakailangang patlang ay minarkahan *