468,278 Members | 1,516 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,278 developers. It's quick & easy.

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 2587
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Raterus | last post: by
5 posts views Thread by MikeB | last post: by
reply views Thread by vinay | last post: by
3 posts views Thread by =?Utf-8?B?UGF0UA==?= | last post: by
1 post views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.