Show me the metadata!

WCF LOB Adapter SDK extends the WCF channel architecture with Metadata Object Model and provides an infrastructure for browsing, searching, retrieving and importing metadata from the adapter. What is metadata? See this wikipedia definition for a more descriptive definition. The WCF LOB Adapter metadata includes metadata about LOB supported functionality. It can include structure data descriptions like APIs, capabilities and message exchange protocols supported by the target application. For example, metadata for a database may include retrieving data about all the available tables and stored procedures in the database. Irrespective of how the target application defines it metadata, the WCF LOB Adapter uses the WCF metadata specifications to expose metadata for an adapter. WCF supports a variety of metadata formats including WSDL, XML Schema, WS-Policy, WS-MetadataExchange and WS-Addressing.

The metadata for a WCF Service typically includes descriptions of service endpoints, bindings, contracts, operations and messages. In the context of adapters, the metadata for a WCF LOB Adapter has following characteristics:

a) Describes the systems capabilities, APIs and message exchange protocols supported by the target application in WCF metadata format

b) Provides interfaces for filtering the available metadata

c) Generates “in-proc” WCF Service and Service Contract based on the filtered metadata

Thus, Adapter SDK provides public interfaces for exploring and getting metadata.

  • Explore Metadata
    • Returns selected Metadata Nodes (MetadataRetrievalNode[])
    • Uses Adapter Metadata Browse Handler and/or Adapter Metadata Search Handler
  • Get Metadata
    • Returns Consumer Driven Contract (System.Web.Services.Description.ServiceDescription – WSDL / XML Schema)
    • Uses Adapter Metadata Resolver Handler

A default UI is provided out-of-the-box by the Adapter SDK that uses these interfaces to return a .NET proxy in case of Add Adapter Service Reference Visual Studio Plug-In and XML Schemas in the context of Consume Adapter Service BizTalk Project Add-In. However, the public interfaces are extensible and can be reused by the Adapter Developer to implement their own browse, search and retrieval functionality if they wish to do so. The following figure shows various metadata related methods supported by the Adapter SDK.

Figure 1: Metadata characteristics supported by the Adapter SDK

The primary step in obtaining metadata from an adapter involves exploring the available functions and business objects within the adapter. The hierarchy and categorization of metadata differs for each adapter implementation. The information is returned for only a single level of hierarchy at a time in order to avoid having to retrieve entire tree at once. Each node in the tree is represented using Adapter SDK class called MetadataRetrievalNode.

· /

o Category1

§ Category 1.1

· Operation 1.1.1

· Operation 1.1.2

o Category2

§ Operation 2.1

§ Category 2.1

§ Category 2.2

· Operation 2.2.1

· Operation 2.2.2

The next step after exploring is to select the categories and/or operations from available metadata and obtain a WCF Service Contract using these selected categories/operations.

When a request to get the service contract from adapter is made, the Adapter SDK calls the Adapter’s Metadata Resolve Handler for resolving adapter metadata to compose a WCF Service Contract under the covers. Adapter SDK provides Metadata Object Model to represent target system’s metadata in an object-oriented format. Adapter SDK converts this metadata object model to WCF service contract. If the selected nodes are found in the Adapter SDK’s metadata cache, the metadata object model is obtained from the cache. Otherwise Adapter’s Metadata Resolver Handler queries the target system’s metadata repository for up-to-date data structure, builds the Adapter SDK’s metadata object model structure and use the built-in WSDL builder to return the service-oriented metadata to client. The key classes in play for representing metadata object model are OperationMetadata, OperationParameter, OperationResult, TypeMetadata, QualifiedType and their subclasses. If the target system already has XML Schema definitions available to represent input and output of an operation, the schemas can be passed in within the OperationMetadata class to auto-construct the encapsulated metadata object model.

Programming Lifecycle

The following table shows the programming lifecycle of a WCF LOB Adapter in comparison with the WCF Service. Once the Consumer Driven Contract is generated by the Adapter, the consuming of an adapter using a WCF client is identical to consuming of a WCF service.

In my next posts, I will provide more detailed information about Adapter SDK’s metadata architecture including covering the following topics.

Adapter Developer Topics

· Publish adapter metadata

o Implementing Metadata Browse Handler

o Implementing Metadata Search Handler

· Resolve adapter metadata

o Implementing Metadata Resolver Handler

· Export service description from the adapter

o (Optional) Implementing custom WSDL builder

· Understanding metadata cache

· Using metadata at runtime during message exchange flow

Adapter Consumer Topics

· Generate a WCF client from adapter metadata using Add Adapter Service Reference Visual Studio Plug-In

· Generate schema files for BizTalk projects from adapter metadata using Consume Adapter Service BizTalk Project Add-In

· Retrieve metadata from the adapter using WCF Client Channels

· Retrieve metadata using WS-MEX (WS-MetadataExchange)

· Retrieve metadata using Adapter SDK’s common UI component MetadataSearchBrowse

 

show me the metadata.docx