The Path Object


The Path Object

The cornerstone of your control over message routing is the Path object. This object contains the routing details for the current request, and WSE uses it to determine where the message is actually sent. Instances of the Path object are used in two places.

The first place that we see the Path object is within the SoapContext object that we looked at in Chapter 13. As you’ll soon see when we look at the way that WSE implements routing, the usefulness of the Path object that is available within the SoapContext object is questionable. The Path object within the request’s SoapContext object is populated by the Routing input filter from the routing details, but the Path object within the response’s SoapContext object is undefined and cannot be altered. You can interrogate the Path object within the request’s SoapContext, but unless you manually route the incoming message, all you have is a read-only copy of the routing information.

Not until you start using the routing facilities that WSE provides do you see a Path object that is useful. As you’ll see in the next section, WSE provides a much more elegant way of implementing routers. Here’s where the second instance of the Path object makes an appearance: when you’re implementing a WSE router, you’re passed an instance of the Path object that contains the outgoing path that messages leaving the router will take. We’ll see this shortly.

The Path object effectively maps directly to the WS-Routing header that you saw in Chapter 12; properties are available that relate directly to the elements within the header. The three most commonly used properties are listed in Table 14-1.

Table 14-1: Properties of the Path Object (Partial List)

Property

Description

Fwd

Maps to the <wsrp:fwd> element and contains the forward path details of the message. This property returns a collection of Via elements that map to the contained <wsrp:via> elements.

Rev

Maps to the <wsrp:rev> element and contains the reverse path details of the message. This property returns a collection of Via elements that map to the contained <wsrp:via> elements.

To

Maps to the <wsrp:to> element and contains the ultimate destination of the message.

The Path object does contain a few other properties, as you’ll see in the WSE documentation, but the three listed in the table are the ones we’ll use when we use routers in this chapter.




Programming Microsoft. NET XML Web Services
Programming MicrosoftВ® .NET XML Web Services (Pro-Developer)
ISBN: 0735619123
EAN: 2147483647
Year: 2005
Pages: 172

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net