Freigeben über


WS-Eventing Part III: The Notification Message

Ok, now pay close attention; this part gets real complicated. The required elements of a notification message (that is, the shark-attack message sent to the subscriber) are as follows:

That’s right, there are no required elements. Any SOAP message can be a valid notification. The event source and the event sink (aka the subscriber) must agree on the notification format, and the WS-Eventing spec doesn’t mandate how that agreement is achieved. A couple options occur to me off the top of my head. Documentation can specify the format, and both sides can simply use the same documented format for the message. Alternatively, the format could be published via WSDL at the event source, which the subscriber could use to process the notification message or generate a proxy for it. (Or would that be a stub?)

If the subscriber really needs to know which subscription a particular notification is associated with, that subscriber can attach a tag to the subscription request. That tag will then be included in all notification messages the event source sends to that subscriber. The tag looks like this:

<Envelope>

    <Header>

        <Action>https://schemas.xmlsoap.org/ws/2004/01/eventing/Subscribe</Action>

        <MessageID>https://www.me.com/subscriptions/583</MessageID>

        <ReplyTo>https://www.me.com/subscription-response-handler</ReplyTo>

        <To>https://www.ocean.com/notifications/shark-attacks</To>

    </Header>

    <Body>

        <Subscribe>

            <NotifyTo>

                <Address>https://www.me.com/shark-attack-notification-handler</Address>

                <ReferenceProperties>

                    <MyCustomHeader>This is from my shark-attack subscription!</MyCustomHeader>

                </ReferenceProperties>

            </NotifyTo>

        </Subscribe>

    </Body>

</Envelope>

This will force the event source to add that tag as a header to every notification that it sends to that subscriber, like so:

<Envelope>

    <Header>

        <To> https://www.me.com/shark-attack-notification-handler\</To>

        <MyCustomHeader>This is from my shark-attack subscription!</MyCustomHeader>

    </Header>

    <Body>

        <SharkAttackInfo>

           <Location>Daytona Beach</Location>

           <NumberOfStitches>184</NumberOfStitches>

        </Subscribe>

    </Body>

</Envelope>

Comments

  • Anonymous
    February 17, 2004
    is publishing with "MyCustomHeader" tag actually required by WS-E or one of the things that occur to you?

    Thanks. Great job.
  • Anonymous
    February 17, 2004
    Mike, I made up the element name; it could be anything, and does not need to be specified. If the subscriber does include any elements inside the <ReferenceProperties> of the subscription, however, the event source MUST echo them back inside each notification to that subscriber.
  • Anonymous
    February 17, 2004
    Sweet. Thanks. BTW, did you remember to color code all of the places where data gets forwarded from the subscription to the response? I'm using RSSBandit and most of the text is still black, except that which is blue.
  • Anonymous
    February 17, 2004
    The comment has been removed
  • Anonymous
    March 11, 2004
    I am trying to figure out how to define the web service that receives the different eventing messages. Are there any samples around in C# or VB.NET that defines a simple subscription web service method?

    I have found how to add the SOAP header but I really want to see how all the namespaces are added into the web service so the WSDL is correct.

    Thanks.
  • Anonymous
    November 25, 2007
    PingBack from http://feeds.maxblog.eu/item_248317.html
  • Anonymous
    June 09, 2009
    PingBack from http://cellulitecreamsite.info/story.php?id=8381