AspAlliance.com LogoASPAlliance: Articles, reviews, and samples for .NET Developers
URL:
http://aspalliance.com/articleViewer.aspx?aId=753&pId=-1
Exploring the Pipeline Class Using Web Services Enhancements SP2
page
by Jayaram Krishnaswamy
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 17582/ 43

Introduction

This article specifically deals with exploring the properties and methods of the Pipeline Class. However, knowledge of the WSE architecture is important since incoming and outgoing messages pass through the Pipeline. The input and output filters constitute the Pipeline. Details of Pipeline class are not documented sufficiently in the WSEREF [Web Services Enhancements Reference Document]. The author has interrogated the class members in the preparation of this explorative tutorial. Also it may be noted that SP3 has been recently released.

Communication with messages is central to web services, and therefore there is a strong reason to understand how messages are formed and processed. The distributed messaging that is at the heart of interoperability, would bring in a set of complications, such as different methods of transport; requirements for processing messages at intermediate points etc

Pipeline

There are several contexts, in which the word pipeline is used, such as the HTTP Pipeline, the BizTalk pipeline, the commerce server pipeline, etc. However, in the context of WSE2.0, Pipeline refers to the constructs involved in processing incoming and outgoing messages from a web service, or a SOAP Node. The incoming and outgoing messages are filtered to get at the information contained in the SOAP headers. This functionality for the incoming/outgoing messages is handled by the input and output filters as shown in this picture from Microsoft's WSE2.0 documentation. However, additionally there may be several intermediaries that function both as a receiver and a sender.

Message processing is handled by the pipeline in conjunction with the SoapContext class. It is through the use of SoapContext the user accesses the Filter functions. The default filters in WSE2.0 are the following:

·         Diagnostics

·         Security

·         Referral

·         Policy

·         TimeStamp

Two separate arrays of objects, SoapInputFilter and SoapOutputFilter that filters the SOAP messages are contained in the Pipeline class. These arrays are contained in the SoapInputFilterCollection and SoapOutputFilterCollection classes. These filters are independently included in the several other namespaces in WSE2.0. The orders in which the incoming message or, the outgoing message face the filters before they get filtered are different. Also it is possible to customize the pipeline so as to include/omit the default filters, or add custom filters. WSE2.0 also supports ordering the filters. These functionalities offered by the various methods cuts down the overhead in processing messages and helps optimization. It may also be noted that all filters are enabled by default on the web service. On the web client such default enabling is contingent upon the client proxies deriving from the WebServicesClientProtocol class.

Pipeline Class: Properties and Methods

PipeLine Class Properties

The next tree diagram shows the properties of the Pipeline class expanded to show all the properties. Code snippets from the web service described in the next section will clarify some of the properties.

Examining the Properties with an Example

Create a web service project, herein called TPipeLine, remove the default Service1.asmx file and add a new web service file called, TPProps.asmx. Now apply web service extensions 2.0, by right clicking the highlighted project and clicking on WSE2.0 Settings... as shown.

This brings up the WSE2.0 settings dialogue as shown wherein you enable the two checkboxes, if you want to enable the second checkbox, you must have enabled the first. The first checkbox enables the project for WSE and the second will add the web service enhancement soap extensions to the project which is applicable to ASP.Net projects. The other tabs are not configured in the preparation of this tutorial.

The first check box adds reference to the Microsoft.web.services2.dll to the project and an element to the configuration of the web.config file as shown.

<microsoft.web.services2>
  <diagnostics />
</microsoft.web.services2>

The second checkbox adds the following to the configuration of the web.config file.

<webServices>
  <soapExtensionTypes>
    <add
type="Microsoft.Web.Services2.WebServicesExtension,
Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
priority="1" group="0" />
  </soapExtensionTypes>
</webServices>

This procedure will be used in all the examples to follow as the various classes are explored.  In order to call up the Pipeline methods we need to instantiate a new instance of the pipeline using the constructor from among the overload list shown in this table.

Name

Description

Pipeline ()

Initializes a new instance of the Pipeline class.

Pipeline (Pipeline)

Initializes a new instance of the Pipeline class with the specified Pipeline object.

Pipeline (SoapInputFilterCollection, SoapOutputFilterCollection)

Initializes a new instance of Pipeline with the specified collections of SOAP input and output filters.

Actor Property

In the discussion to follow, we shall use the parameterless constructor for Pipeline. We shall add a WebMethod to the ASMX file after removing the HelloWorld example as shown. In order to reference the WSE2.0, an Imports Microsoft.Web.Services2 statement should be added to the TPProps class file. This property has a value System.Uri, the default value according to WSEREF [Web Services Extensions Reference Documentation] is Microsoft.Web.Services2.Addressing.WSAddressing.AnonymousRole. The following code will return the Pipeline's Actor property.

When you invoke this method in the browser, you will display the following, returned by the method:

<string>
http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous
</string>

InputFilters Property

As described in the basics, there are a number of filters in the pipeline and we should be able to find out what they are by looking at the InputFilters property by coding the following:
Return pline.InputFilters.Item(0).GetType.ToString
When the method is invoked in the browser, you display the following string:

<string>
Microsoft.Web.Services2.Security.SecurityInputFilter
</string>

In the same way, if you want to find how many filters there are, use the following:
Return pline.InputFilters.Count. This will display the following in the browser.

<string>
3
</string>

The following table summarizes the statements and the displayed results by invoking the method.

Index

Type of Filter

Return

pline.InputFilters.Item(0).GetType.ToString

<string>

Microsoft.Web.Services2.Security.SecurityInputFilter

</string>

Return pline.InputFilters.Item(1).GetType.ToString

<string>

Microsoft.Web.Services2.Referral.ReferralInputFilter

</string>

Return pline.InputFilters.Item(2).GetType.ToString

<string>

Microsoft.Web.Services2.Policy.PolicyVerificationInputFilter

</string>

 

OutputFilters Property

The OutputFilters property of the Pipeline follows the same pattern as the InputFilters property.  These are summarized in the following table.

Index

Type of Filter

Return pline.OutputFilters.Item(0).GetType.ToString

<string>

 Microsoft.Web.Services2.Security.SecurityOutputFilter

</string>

Return pline.OutputFilters.Item(1).GetType.ToString

<string>

Microsoft.Web.Services2.Referral.ReferralOutputFilter

</string>

Return pline.OutputFilters.Item(2).GetType.ToString

<string>

Microsoft.Web.Services2.Policy.PolicyEnforcementOutputFilter

</string>

IsIntermediary Property

When messages are going from an originating node(Sender) to an ultimate endpoint(Receiver) after passing thorough many 'routers'(soap Processing Nodes) in between, the IsIntermediary property provides a Boolean value of true, if the node is an Intermediary, and false otherwise. This property can also be set for a custom soap message. The following code returns a false as this node is not an intermediary.

Public Function PActor () As String
  Dim pline As New Pipeline
  Try
    Return pline.IsIntermediary
  Catch ex As SystemException
    Return ex.Message
  End Try
End Function
Summary

This explorative tutorial has looked at some of the properties and methods of the Pipeline class in WSE2.0. The pipeline refers to the architecture of the filters at a SOAP node and how to access them by the attributes of properties and methods. In this tutorial only the default initiator for the pipeline class has been used. The details of the filters are included in other classes separately.  Please also consult the following references.

Programming Microsoft .NET XML Web Services by D.Foggon et al, Published by Microsoft Press, ISBN 0-7356-1912-3, 2003

Understanding Web Services Specifications and the WSE by J.H.Gailey, Published by Microsoft Press, ISBN 0-7356-1913-1, 2004

 

 


Product Spotlight
Product Spotlight 

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-29 9:52:59 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search