DekGenius.com
[ Team LiB ] Previous Section Next Section

Chapter 31. The System.Web.Services.Configuration Namespace

The System.Web.Services.Configuration namespace contains three .NET attributes that are useful if you want to add custom format extensions to your web services (in other words, if you want to insert additional XML elements to your web service's WSDL service description). One practical reason to use a format extension is if your web service requires a SOAP extension that runs at both the server and the client end. By default, no information about SOAP extensions is added to the service description, meaning that clients may not be aware that they need to use a given extension (for example, a security or encryption extension) before they can use the web service.

To use a format extension in this way, you need to start by deriving a custom class from System.Web.Services.Description.ServiceDescriptionFormatExtension, which represents the actual format extension. Next, you use the XmlFormatExtensionAttribute in this namespace with the class to define the extension points where the extension should apply. Optionally, you can use the XmlFormatExtensionPointAttribute class with the custom format extension class to specify a member in the class that will act as a new extension point, and the XmlFormatExtensionPrefixAttribute to set an XML namespace for the elements generated by the format extension. Finally, you configure your format extension to run within the <serviceDescriptionFormatExtensionTypes> section of the configuration file. Figure 31-1 shows the types in this namespace.

Figure 31-1. The System.Web.Services.Configuration namespace
figs/anet2_3101.gif
    [ Team LiB ] Previous Section Next Section