Invokazzjoni SSRS Web Services Mill WSS / MOSS fl FBA Ambjent

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: Mhux awtorizzat
  • Għan Ittrasferit

The "object moved" message was most interesting because it was saying that the "object" (SSRS servizz tagħna) 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 (bħala ta ' 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".

Hawn il-kodiċi li ħadmu għalina:

ReportingService2006 rs = null; 
// Authenticate Authentication auth = ġdid Authentication(); 
auth.Url = "http://URL/_vti_bin/Authentication.asmx";
auth.CookieContainer =
ġdid CookieContainer();
LoginResult result = auth.Login("userid", "password");
jekk (result.ErrorCode == LoginErrorCode.NoError) 
{
// No error, so get the cookies.
CookieCollection cookies = auth.CookieContainer.GetCookies(ġdid Uri(auth.Url));
Cookie authCookie = cookies[result.CookieName];
rs =
ġdid ReportingService2006();
rs.Url =
"http://server/_vti_bin/ReportServer/ReportService2006.asmx";
rs.CookieContainer =
ġdid CookieContainer();
rs.CookieContainer.Add(authCookie);
}
jippruvaw
{
  rs.CreateSubscription(report, extSettings, desc, eventType, matchData, parameters1);
}
qabda (Eċċezzjoni ex)
{
  WriteLine(ex.Message.ToString());
}

I interpret things to work like this:

  • Parti web tagħna jeħtieġ li dial up-servizz awtentikazzjoni u jgħidu, "Hey, Tony, huwa me!".
  • Jirrispondi Awtentikazzjoni qal, "Hey, I know you. How are the kids? Here’s a token."
  • Aħna nsejħu l-servizz SSRS u jgħidu, "Tony sent me, hawn l-token."

</aħħar>

Abbona għall-blog tiegħi.

Ħalli Irrispondi

Your email address mhux se jkun ippubblikat. Meħtieġa oqsma huma mmarkati *