Professional Web Applications Themes

Routing with WSE 2.0 - ASP.NET Web Services

Hi All, I'm trying to develop a custom SoapHttpHandler, but it just doesn't want to work. Here's my handler public class BrokerRoutingHandler : Microsoft.Web.Services2.Messaging.SoapHttpRouter { protected override Uri ProcessRequestMessage( SoapEnvelope message) { System.Diagnostics.EventLog EventLog1 = new System.Diagnostics.EventLog(); if (!System.Diagnostics.EventLog.SourceExists("Broker ")) System.Diagnostics.EventLog.CreateEventSource( "Broker", "Application"); EventLog1.Source = "Broker"; EventLog1.WriteEntry ("Intercepted a message and passed it on."); // Code goes here to intercept the message and have a tweak. return base.ProcessRequestMessage (message); } } Simple enough - the idea is that when this intercepts a message it will post to the event log just so I know it's doing something. I updated the ...

  1. #1

    Default Routing with WSE 2.0

    Hi All,

    I'm trying to develop a custom SoapHttpHandler, but it just doesn't want to
    work. Here's my handler

    public class BrokerRoutingHandler :
    Microsoft.Web.Services2.Messaging.SoapHttpRouter
    {
    protected override Uri ProcessRequestMessage( SoapEnvelope message)
    {
    System.Diagnostics.EventLog EventLog1 = new
    System.Diagnostics.EventLog();

    if (!System.Diagnostics.EventLog.SourceExists("Broker "))
    System.Diagnostics.EventLog.CreateEventSource(
    "Broker", "Application");

    EventLog1.Source = "Broker";
    EventLog1.WriteEntry ("Intercepted a message and passed it on.");


    // Code goes here to intercept the message and have a tweak.
    return base.ProcessRequestMessage (message);
    }

    }
    Simple enough - the idea is that when this intercepts a message it will post
    to the event log just so I know it's doing something.

    I updated the web.config as the WSE doenation says to do for content
    based routing, to include this

    <system.web>
    :
    :
    <httpHandlers>
    <add type="BrokerService.BrokerRoutingHandler, BrokerService" path="*.asmx"
    verb="*" />
    </httpHandlers>
    </system.web>

    So, any request for any web service hits my customer handler.

    To build the application I created a standard web service project, with a
    web service in it, then added in WSE2.0 support, and then added in the class
    above.

    The problem is, when I hit F5 to run the app just to make sure everything's
    ok, I get this

    "WSE003: The input was not a valid SOAP message"

    I have tried pretty much all I can think of to solve this. Any ideas?
    (All replies to the group please -I've searched Google relentlessly for a
    solution or anyone that's come across WSE003 as an error code and found
    nothing, so we should probably keep this public.)


    Cheers,


    --
    Pete Wright
    Author of ADO.NET Novice to Pro for Apress
    [url]www.petewright.org[/url]


    Pete Wright Guest

  2. #2

    Default Re: Routing with WSE 2.0

    Hello Pete,
    Cannot hit F5 and run a web service. You would need to create a web service
    client and send a soap message to it. What seems to be happening here is,
    when you hit F5 the IDE makes a web request to xyz.asmx and that request
    goes through your router aswell (no surprises there)! If you are just wanting
    to log any request using your router, Id suggest you could just create a
    SoapExtension [0] that traces your request.

    [0] - [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebservicesprotocolssoapextensionclasst opic.asp[/url]
    HTH
    Regards,
    Dilip Krishnan
    MCAD, MCSD.net
    dkrishnan at geniant dot com
    [url]http://www.geniant.com[/url]
    > Hi All,
    >
    > I'm trying to develop a custom SoapHttpHandler, but it just doesn't
    > want to work. Here's my handler
    >
    > public class BrokerRoutingHandler :
    > Microsoft.Web.Services2.Messaging.SoapHttpRouter
    > {
    > protected override Uri ProcessRequestMessage( SoapEnvelope message)
    > {
    > System.Diagnostics.EventLog EventLog1 = new
    > System.Diagnostics.EventLog();
    > if (!System.Diagnostics.EventLog.SourceExists("Broker "))
    > System.Diagnostics.EventLog.CreateEventSource(
    > "Broker", "Application");
    > EventLog1.Source = "Broker";
    > EventLog1.WriteEntry ("Intercepted a message and passed it on.");
    > // Code goes here to intercept the message and have a tweak.
    > return base.ProcessRequestMessage (message);
    > }
    > }
    > Simple enough - the idea is that when this intercepts a message it
    > will post
    > to the event log just so I know it's doing something.
    > I updated the web.config as the WSE doenation says to do for
    > content based routing, to include this
    >
    > <system.web>
    > :
    > :
    > <httpHandlers>
    > <add type="BrokerService.BrokerRoutingHandler, BrokerService"
    > path="*.asmx"
    > verb="*" />
    > </httpHandlers>
    > </system.web>
    > So, any request for any web service hits my customer handler.
    >
    > To build the application I created a standard web service project,
    > with a web service in it, then added in WSE2.0 support, and then added
    > in the class above.
    >
    > The problem is, when I hit F5 to run the app just to make sure
    > everything's ok, I get this
    >
    > "WSE003: The input was not a valid SOAP message"
    >
    > I have tried pretty much all I can think of to solve this. Any ideas?
    > (All replies to the group please -I've searched Google relentlessly
    > for a
    > solution or anyone that's come across WSE003 as an error code and
    > found
    > nothing, so we should probably keep this public.)
    > Cheers,
    >

    Dilip Krishnan Guest

  3. #3

    Default Re: Routing with WSE 2.0

    Thanks Dilip.

    eventually this handler will grow into a dynamic router based on content in
    the message passed in; for now though I'd just be happy to see the handler
    running.

    You are right though - I changed the proxy that I had calling the service to
    use
    Microsoft.Web.Services2.WebServicesClientProtocol

    sinstead of the standard base class. Now I get an error of Destination
    unreachable.

    Does it matter that the handler and web service are on the same machine? Any
    ideas?

    Pete


    "Dilip Krishnan" <dkrishnanNOSPAM.geniant.com> wrote in message
    news:271868632430137404270480msnews.microsoft.com ...
    > Hello Pete,
    > Cannot hit F5 and run a web service. You would need to create a web
    > service client and send a soap message to it. What seems to be happening
    > here is, when you hit F5 the IDE makes a web request to xyz.asmx and that
    > request goes through your router aswell (no surprises there)! If you are
    > just wanting to log any request using your router, Id suggest you could
    > just create a SoapExtension [0] that traces your request.
    >
    > [0] -
    > [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebservicesprotocolssoapextensionclasst opic.asp[/url]
    > HTH
    > Regards,
    > Dilip Krishnan
    > MCAD, MCSD.net
    > dkrishnan at geniant dot com
    > [url]http://www.geniant.com[/url]
    >
    >> Hi All,
    >>
    >> I'm trying to develop a custom SoapHttpHandler, but it just doesn't
    >> want to work. Here's my handler
    >>
    >> public class BrokerRoutingHandler :
    >> Microsoft.Web.Services2.Messaging.SoapHttpRouter
    >> {
    >> protected override Uri ProcessRequestMessage( SoapEnvelope message)
    >> {
    >> System.Diagnostics.EventLog EventLog1 = new
    >> System.Diagnostics.EventLog();
    >> if (!System.Diagnostics.EventLog.SourceExists("Broker "))
    >> System.Diagnostics.EventLog.CreateEventSource(
    >> "Broker", "Application");
    >> EventLog1.Source = "Broker";
    >> EventLog1.WriteEntry ("Intercepted a message and passed it on.");
    >> // Code goes here to intercept the message and have a tweak.
    >> return base.ProcessRequestMessage (message);
    >> }
    >> }
    >> Simple enough - the idea is that when this intercepts a message it
    >> will post
    >> to the event log just so I know it's doing something.
    >> I updated the web.config as the WSE doenation says to do for
    >> content based routing, to include this
    >>
    >> <system.web>
    >> :
    >> :
    >> <httpHandlers>
    >> <add type="BrokerService.BrokerRoutingHandler, BrokerService"
    >> path="*.asmx"
    >> verb="*" />
    >> </httpHandlers>
    >> </system.web>
    >> So, any request for any web service hits my customer handler.
    >>
    >> To build the application I created a standard web service project,
    >> with a web service in it, then added in WSE2.0 support, and then added
    >> in the class above.
    >>
    >> The problem is, when I hit F5 to run the app just to make sure
    >> everything's ok, I get this
    >>
    >> "WSE003: The input was not a valid SOAP message"
    >>
    >> I have tried pretty much all I can think of to solve this. Any ideas?
    >> (All replies to the group please -I've searched Google relentlessly
    >> for a
    >> solution or anyone that's come across WSE003 as an error code and
    >> found
    >> nothing, so we should probably keep this public.)
    >> Cheers,
    >>
    >
    >

    Pete Wright Guest

  4. #4

    Default Re: Routing with WSE 2.0

    Solved the problem.

    By having the handler registered as "*.asmx* what was happening was that the
    router was initially triggering and then directing out to something.asmx.
    This would then pop back into the router and get thrown out since each time
    the router gets hit the next Via is set to the current To:, so the second
    time around To is cleared out and there are no more vias - if that makes
    sense, so the result is desintation unreachable.

    The solution is to have the handler pick up specific names (since this is a
    broker we are going for request.asmx and publish.asmx) and then route out to
    the appropriate service, OR always route out to asmx files in a different
    virtual directory. The latter is better because then you really can keep the
    router on one machine and services on another.


    "Pete Wright" <peterjwright> wrote in message
    news:O2PcMlfCFHA.2600TK2MSFTNGP09.phx.gbl...
    > Thanks Dilip.
    >
    > eventually this handler will grow into a dynamic router based on content
    > in
    > the message passed in; for now though I'd just be happy to see the handler
    > running.
    >
    > You are right though - I changed the proxy that I had calling the service
    > to
    > use
    > Microsoft.Web.Services2.WebServicesClientProtocol
    >
    > sinstead of the standard base class. Now I get an error of Destination
    > unreachable.
    >
    > Does it matter that the handler and web service are on the same machine?
    > Any
    > ideas?
    >
    > Pete
    >
    >
    > "Dilip Krishnan" <dkrishnanNOSPAM.geniant.com> wrote in message
    > news:271868632430137404270480msnews.microsoft.com ...
    >> Hello Pete,
    >> Cannot hit F5 and run a web service. You would need to create a web
    >> service client and send a soap message to it. What seems to be happening
    >> here is, when you hit F5 the IDE makes a web request to xyz.asmx and that
    >> request goes through your router aswell (no surprises there)! If you are
    >> just wanting to log any request using your router, Id suggest you could
    >> just create a SoapExtension [0] that traces your request.
    >>
    >> [0] -
    >> [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebservicesprotocolssoapextensionclasst opic.asp[/url]
    >> HTH
    >> Regards,
    >> Dilip Krishnan
    >> MCAD, MCSD.net
    >> dkrishnan at geniant dot com
    >> [url]http://www.geniant.com[/url]
    >>
    >>> Hi All,
    >>>
    >>> I'm trying to develop a custom SoapHttpHandler, but it just doesn't
    >>> want to work. Here's my handler
    >>>
    >>> public class BrokerRoutingHandler :
    >>> Microsoft.Web.Services2.Messaging.SoapHttpRouter
    >>> {
    >>> protected override Uri ProcessRequestMessage( SoapEnvelope message)
    >>> {
    >>> System.Diagnostics.EventLog EventLog1 = new
    >>> System.Diagnostics.EventLog();
    >>> if (!System.Diagnostics.EventLog.SourceExists("Broker "))
    >>> System.Diagnostics.EventLog.CreateEventSource(
    >>> "Broker", "Application");
    >>> EventLog1.Source = "Broker";
    >>> EventLog1.WriteEntry ("Intercepted a message and passed it on.");
    >>> // Code goes here to intercept the message and have a tweak.
    >>> return base.ProcessRequestMessage (message);
    >>> }
    >>> }
    >>> Simple enough - the idea is that when this intercepts a message it
    >>> will post
    >>> to the event log just so I know it's doing something.
    >>> I updated the web.config as the WSE doenation says to do for
    >>> content based routing, to include this
    >>>
    >>> <system.web>
    >>> :
    >>> :
    >>> <httpHandlers>
    >>> <add type="BrokerService.BrokerRoutingHandler, BrokerService"
    >>> path="*.asmx"
    >>> verb="*" />
    >>> </httpHandlers>
    >>> </system.web>
    >>> So, any request for any web service hits my customer handler.
    >>>
    >>> To build the application I created a standard web service project,
    >>> with a web service in it, then added in WSE2.0 support, and then added
    >>> in the class above.
    >>>
    >>> The problem is, when I hit F5 to run the app just to make sure
    >>> everything's ok, I get this
    >>>
    >>> "WSE003: The input was not a valid SOAP message"
    >>>
    >>> I have tried pretty much all I can think of to solve this. Any ideas?
    >>> (All replies to the group please -I've searched Google relentlessly
    >>> for a
    >>> solution or anyone that's come across WSE003 as an error code and
    >>> found
    >>> nothing, so we should probably keep this public.)
    >>> Cheers,
    >>>
    >>
    >>
    >
    >

    Pete Wright Guest

Similar Threads

  1. Routing
    By Dave McDuell in forum Windows Server
    Replies: 1
    Last Post: June 28th, 07:24 PM
  2. Help on routing
    By Martin Jeppesen in forum Linux / Unix Administration
    Replies: 0
    Last Post: October 15th, 02:24 AM
  3. arp and routing tables
    By David Medeiros in forum UNIX Programming
    Replies: 0
    Last Post: July 21st, 08:03 PM
  4. Routing Table
    By Chris in forum Windows Networking
    Replies: 1
    Last Post: July 19th, 11:58 AM
  5. All TCP/IP routing through modem
    By Hamilton in forum Windows Networking
    Replies: 0
    Last Post: July 16th, 07:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139