473,396 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can Application_BeginRequest return a DataSet and stop normal webmethod flow?



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

*** Sent via Developersdex http://www.developersdex.com ***
Nov 23 '05 #1
2 2340

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

"Ana Santana" <an*********@banifinvestimento.pt> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...


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

*** Sent via Developersdex http://www.developersdex.com ***

Nov 23 '05 #2

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

"Ana Santana" <an*********@banifinvestimento.pt> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...


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

*** Sent via Developersdex http://www.developersdex.com ***

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport)...
5
by: SMG | last post by:
Hi All, I have a Web Service, which returns a DataSet and I am able to consume. This is ok. Now I want to return two things, 1. DataSet 2. String Through one request only, I thot of using...
7
by: Ankit Aneja | last post by:
I put the code for url rewrite in my Application_BeginRequest on global.ascx some .aspx pages are in root ,some in folder named admin and some in folder named user aspx pages which are in user...
0
by: Ana Santana | last post by:
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...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
14
by: dcassar | last post by:
I have had a lively discussion with some coworkers and decided to get some general feedback on an issue that I could find very little guidance on. Why is it considered bad practice to define a...
0
by: Rahul | last post by:
I am using Application_BeginRequest function in my Global.ascx file and I have a breakpoint set over there. I have a master page and and one of the content of the master page pints to...
3
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I've used an Application_BeginRequest function in my global.asax page to implement some URL rewriting functionality on our website. However, upon moving it to my host (1&1.co.uk), it...
1
by: =?Utf-8?B?R3JlZw==?= | last post by:
I've been playing around with the Global.asax file and learning how it can help me with my web application. I created an Application_EndRequest() method with a Response.Write("Output"); line of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.