Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

Centralize SOAPHeader Processing?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Spam Catcher - 17 Apr 2008 06:41 GMT
Hi all,

In an ASP.NET web service, is there a way I can centralize processing of
SOAP Headers?

Currently I need to nput my header logic into each webmethod - is there an
event, mechanism, extension, etc I can hook into to do all my processing
before the webmethod is executed?

Thanks!

Signature

spamhoneypot@rogers.com (Do not e-mail)

John Saunders - 21 Apr 2008 19:47 GMT
> Hi all,
>
[quoted text clipped - 4 lines]
> event, mechanism, extension, etc I can hook into to do all my processing
> before the webmethod is executed?

There's no general way to do this. However, you can apply various design
patterns to save some effort.

I don't know a name for the following pattern, but here's what I did for one
web service. I abstracted the web methods into classes. Each web method had
its own little class. I was then able to consider what was in common among
several of the classes - for instance, header processing. That which was in
common got moved into a base class.

This left my .ASMX.cs file as nothing more than a façade. Each web method
simply instantiated the corresponding "service layer" class, passing the web
method parameters into the constructor call. It then called the "Execute"
method of the class. Execute was a method on the base class. It called a
virtual PreProcess method, then a virtual ExecuteImplementation method, then
a virtual PostProcess method. Certain derived classes would override
PreProcess (for instance, to process a particular set of SOAP Headers), and
ExecuteImplementation to impose a common processing pattern.

This allows specialization of classes to correspond to specialization of
behavior.

This was also done in a bit of a hurry. I'm sure others can do better.

Signature

--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.