473,387 Members | 1,863 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,387 software developers and data experts.

Redirect all WS & webmethod requests to one webmethod?

Folks,
I've been building a Webservice API for a contract that will be exposed to
the internet at large. There are two endpoints, and each endpoint contains a
number of webmethods. Every webmethod returns a returncode which indicates
the level of success in performing the operation (as well as the actual
results of the call in an "out" parameter)

They have a requirement that when they want to perform maintenance on the
backend system, that they want all webmethods to return a "System not
available" returncode.

Now my initial stab at this was to have each webmethod check some parameter
in the web.config and exit early if it was true, but this is not acceptable,
as they run in a loadbalanced environment, and may have to update many
web.configs.

The mechanism the contract wishes to use (which they already use for their
main website when performing maintenance) is based around adjusting
priorities on their load balancer and redirecting all requests to a "splash"
page ("The system is currently undergoing maintenance, please try again
later"). They want an equivalent for the Webservice API.

So what I have started to do is to create a new webservice project, and add
a httpHandler that redirects every request to a class within the project
(this is how I am forcing requests to either of the endpoints to go to one
class). I'd then like to be able to override something within the WebService
base class that would force all webmethods to be redirected to one webmethod,
which simply returns a "System not available" returncode.

I'd like to do it this redirect way, cos I really don't want to have to
maintain the same WS API in two separate projects (IE every time I add a
webmethod to the main project, that I have to add a stub to the second). I'd
much rather spend more time now getting it right, and not having to look at
it again.

Any ideas what I need to do? Any references? etc etc

Cheers
Pete
Nov 21 '05 #1
2 2808
Hi Peter,

Try adding in a generic Web Service Extension via config file that checks
the web.config file , or some other adminstratively settable flag. In the
case where the "System Not Available", just have the extension intercept
the request and throw a fault (this is probably the right approach - this
is NOT a success case.

This way you could have this simple installable add-in that you configure
into any method you like.

The other alternative is to have them redirect the vroot to a custom HTTP
error and replace the page's HTML output with a SOAP FAULT response.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: Redirect all WS & webmethod requests to one webmethod?
thread-index: AcTWv9/6HGCBlbI5QpGpuXEIuKg6zQ==
X-WBNR-Posting-Host: 62.17.162.113
From: =?Utf-8?B?UGV0ZXIgTWNFdm95?= <Pe*********@discussions.microsoft.com>
Subject: Redirect all WS & webmethod requests to one webmethod?
Date: Tue, 30 Nov 2004 01:35:05 -0800
Lines: 39
Message-ID: <E9**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGXA0
3.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7695
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Folks,
I've been building a Webservice API for a contract that will be exposed to
the internet at large. There are two endpoints, and each endpoint contains
a
number of webmethods. Every webmethod returns a returncode which indicates
the level of success in performing the operation (as well as the actual
results of the call in an "out" parameter)

They have a requirement that when they want to perform maintenance on the
backend system, that they want all webmethods to return a "System not
available" returncode.

Now my initial stab at this was to have each webmethod check some parameter
in the web.config and exit early if it was true, but this is not
acceptable,
as they run in a loadbalanced environment, and may have to update many
web.configs.

The mechanism the contract wishes to use (which they already use for their
main website when performing maintenance) is based around adjusting
priorities on their load balancer and redirecting all requests to a
"splash"
page ("The system is currently undergoing maintenance, please try again
later"). They want an equivalent for the Webservice API.

So what I have started to do is to create a new webservice project, and add
a httpHandler that redirects every request to a class within the project
(this is how I am forcing requests to either of the endpoints to go to one
class). I'd then like to be able to override something within the
WebService
base class that would force all webmethods to be redirected to one
webmethod,
which simply returns a "System not available" returncode.

I'd like to do it this redirect way, cos I really don't want to have to
maintain the same WS API in two separate projects (IE every time I add a
webmethod to the main project, that I have to add a stub to the second).
I'd
much rather spend more time now getting it right, and not having to look at
it again.

Any ideas what I need to do? Any references? etc etc

Cheers
Pete

Nov 21 '05 #2
THanks again Dan... in this case, I actually went with a slimed-down copy of
each of my asmx files - the methods in this always return the errorcode that
I require. While it's not really generic enough for me to be happy with, it
gets the job done.

I have to disagree with you that I should be throwing a SOAP fault: the
requirement is that we need to stop access to the real APIs while we perform
backend maintenance - so in effect, it is a sucess case, just not a
favourable one for the client app: returning an errorcode which indicates
this fact will prevent third party client apps from crashing, and save alot
of support calls to our customer service people.

Thanks for taking the time to respond tho...

Pete

"Dan Rogers" wrote:
Hi Peter,

Try adding in a generic Web Service Extension via config file that checks
the web.config file , or some other adminstratively settable flag. In the
case where the "System Not Available", just have the extension intercept
the request and throw a fault (this is probably the right approach - this
is NOT a success case.

This way you could have this simple installable add-in that you configure
into any method you like.

The other alternative is to have them redirect the vroot to a custom HTTP
error and replace the page's HTML output with a SOAP FAULT response.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
Thread-Topic: Redirect all WS & webmethod requests to one webmethod?
thread-index: AcTWv9/6HGCBlbI5QpGpuXEIuKg6zQ==
X-WBNR-Posting-Host: 62.17.162.113
From: =?Utf-8?B?UGV0ZXIgTWNFdm95?= <Pe*********@discussions.microsoft.com>
Subject: Redirect all WS & webmethod requests to one webmethod?
Date: Tue, 30 Nov 2004 01:35:05 -0800
Lines: 39
Message-ID: <E9**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGXA0
3.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7695
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Folks,
I've been building a Webservice API for a contract that will be exposed to
the internet at large. There are two endpoints, and each endpoint contains
a
number of webmethods. Every webmethod returns a returncode which indicates
the level of success in performing the operation (as well as the actual
results of the call in an "out" parameter)

They have a requirement that when they want to perform maintenance on the
backend system, that they want all webmethods to return a "System not
available" returncode.

Now my initial stab at this was to have each webmethod check some parameter
in the web.config and exit early if it was true, but this is not
acceptable,
as they run in a loadbalanced environment, and may have to update many
web.configs.

The mechanism the contract wishes to use (which they already use for their
main website when performing maintenance) is based around adjusting
priorities on their load balancer and redirecting all requests to a
"splash"
page ("The system is currently undergoing maintenance, please try again
later"). They want an equivalent for the Webservice API.

So what I have started to do is to create a new webservice project, and add
a httpHandler that redirects every request to a class within the project
(this is how I am forcing requests to either of the endpoints to go to one
class). I'd then like to be able to override something within the
WebService
base class that would force all webmethods to be redirected to one
webmethod,
which simply returns a "System not available" returncode.

I'd like to do it this redirect way, cos I really don't want to have to
maintain the same WS API in two separate projects (IE every time I add a
webmethod to the main project, that I have to add a stub to the second).
I'd
much rather spend more time now getting it right, and not having to look at
it again.

Any ideas what I need to do? Any references? etc etc

Cheers
Pete

Nov 23 '05 #3

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

Similar topics

2
by: Robert Gordon | last post by:
I now realize I probably should have tried posting this on the IIS board first.. I am running OWA 2003 Server as Front End server to my Exchange 2000 native domain. The FE server is secured by...
3
by: Raterus | last post by:
Anyone know how I can figure out the figure out the response.redirect trail a browser goes through when I'm using response.redirect on the server. Right now Internet Explorer just automatically...
3
by: Alan Silver | last post by:
Hello, Sorry if this is a stupid question, but I can't really see much difference between these tow methods according to the scant info in the SDK. Could anyone enlighten me? TIA -- Alan...
5
by: deko | last post by:
I'm trying to redirect requests for /index.php to /mydirectory/index.php If I use an index file in / with only this line: <?php header("Location:http://www.mysite.com/mydirectory/"); ?> that...
4
by: mike.biang | last post by:
I have an ASP page that is using an XMLHTTP object to request various pages from my server. I keep a single session throughout the XMLHTTP requests by bassing the ASPSESSIONID cookie through the...
5
by: MikeB | last post by:
Hello All, I need to post / redirect to a 3rd party URL with the form variables dynamically created. Can anyone give me any pointers? TIA
0
by: omer013 | last post by:
Hi; I have an aspx page with a WebMethod to redirect the user to another page. The Default.aspx.cs is; public partial class _Default : System.Web.UI.Page { public static void...
0
by: vinay | last post by:
Hi All, I have a requirement to read a cookie and update its value in a webmethod. This webmethod is located in the code behind of an aspx page(used for partial page udpates). I have added the...
3
by: =?Utf-8?B?UGF0UA==?= | last post by:
We have a site that gets many requests for nonexistent pages, files and folders. We want those requests redirected to the index page. However, for static files (i.e. images and some other...
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: 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:
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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.