473,385 Members | 1,427 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,385 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 2339

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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.