Centralize SOAPHeader Processing?

Discussion in 'ASP .Net Web Services' started by Spam Catcher, Apr 17, 2008.

  1. Spam Catcher

    Spam Catcher Guest

    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!

    --
    (Do not e-mail)
     
    Spam Catcher, Apr 17, 2008
    #1
    1. Advertising

  2. "Spam Catcher" <> wrote in message
    news:Xns9A83112EB8527usenethoneypotrogers@127.0.0.1...
    > 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?


    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.

    --
    --------------------------------------------------------------------------------
    John Saunders | MVP - Windows Server System - Connected System Developer
     
    John Saunders, Apr 21, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. All Smiles

    SoapHeader problem

    All Smiles, May 20, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    343
    All Smiles
    May 20, 2004
  2. =?Utf-8?B?QXR1bCBCYWhs?=

    Centralize exception handling

    =?Utf-8?B?QXR1bCBCYWhs?=, Jul 19, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    1,572
    =?Utf-8?B?QnJhZCBSb2JlcnRz?=
    Jul 19, 2005
  3. Chris Roden

    Centralize app_themes

    Chris Roden, Apr 16, 2007, in forum: ASP .Net
    Replies:
    0
    Views:
    343
    Chris Roden
    Apr 16, 2007
  4. Spam Catcher

    Centralize SOAPHeader Processing?

    Spam Catcher, Apr 17, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    294
    John Saunders
    Apr 21, 2008
  5. anne001
    Replies:
    4
    Views:
    127
    anne001
    Sep 27, 2006
Loading...

Share This Page