473,657 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can Application_Beg inRequest 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_Beg inRequest
event, but without success...

So, my question is: Is it possible to use the Application_Beg inRequest
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 2378

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
SoapMessageStag e.BeforeDeseria lize. 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*********@ba nifinvestimento .pt> wrote in message
news:Oh******** ******@TK2MSFTN GP12.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_Beg inRequest
event, but without success...

So, my question is: Is it possible to use the Application_Beg inRequest
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
SoapMessageStag e.BeforeDeseria lize. 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*********@ba nifinvestimento .pt> wrote in message
news:Oh******** ******@TK2MSFTN GP12.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_Beg inRequest
event, but without success...

So, my question is: Is it possible to use the Application_Beg inRequest
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
4119
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
1365
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 object as a return type to the webservices but then how do I re cast it to string and dataset. Will that work.
7
5216
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 folder are using this code of url rewrite project is running completely fine on localhost but after uploading first page (http://emailware.net.temporary.domain.name/user/index.aspx) is fine but as i click 123 Easy-CD Ripper
0
255
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 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.
9
3208
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. What it does is to call a webservice with two parameters, one being a integer, the other one being a "String" which contains XML (not the best practice, however that is the target interface and we cannot change that).
14
3467
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 public member with a return type that is derived from System.Exception? I understand the importance of having clean, concise code that follows widely-accepted patterns and practices, but in this case, I find it hard to blindly follow a standard...
0
1076
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 default.aspx. In this aspx file I load the user Control , thats it. But when i start the web site then I see the page execution goes thru easliy , but after load control happens the Application_Beginrequest is called again and again atleast 10 - 15...
3
2672
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 no longer works. They don't support Application_BeginRequest? They've given me a list of the low-level functions they do support, which can be viewed at http://s221042302.websitehome.co.uk/check.aspx
1
5866
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 code and it displays this text at the bottom of "All" of my pages. So, I figured the Application_BeginRequest will run "before" the page is loaded. It appears to work as I think and if I place a Response.Write() method in it, it displays at the top...
0
8403
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8509
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.