Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2005

Tip: Looking for answers? Try searching our database.

Can Application_BeginRequest return a DataSet and stop normal webmethod flow?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ana Santana - 25 May 2005 12:47 GMT
Hi,

I am implementing a couple of webservices (all in the same web project)
that will access several backoffice systems to get and update different
types of information. All the methods in the several webservices return
a DataSet with the information requested.

All the methods of the Webservices also go through an initial phase of
checking either the Backoffice systems are online or not. If not, they
all return the SAME error DataSet.

To save lines of code (and the redundance of having the same code
repeated all over, with all the possible errors that can arise from
that), I am trying to do that check in the Application_BeginRequest
event, but without success...

So, my question is: Is it possible to use the Application_BeginRequest
event to catch the calls to all the methods of all the webservices, and
return a standard answer to the clients in case of error and not
continue the normal flow of the method called? If so, how can I achieve
that? If not, is there any other way?

I am at a loss...

Thank you in advance,
Ana Santana
Sami Vaaraniemi - 27 May 2005 09:23 GMT
Returning a special DataSet indicating an error will be prone to problems. A
consumer will some day fail to recognize it as an error and will try to do
something with it, and straightening things out after the fact will be
difficult.

In my opinion a better option would be to have a SoapExtension that checks
that the backoffice systems are OK, and if not, throw an exception. The best
place to do this would be in the ProcessMessage override, in
SoapMessageStage.BeforeDeserialize. If you decide that the backoffice
systems are not OK, throw an SoapException and the normal processing of the
request will be short-circuited at that point.

Regards,
Sami

> Hi,
>
[quoted text clipped - 24 lines]
>
> *** Sent via Developersdex http://www.developersdex.com ***

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.