Building a Simple IBF solution - For Beginners, Part 2
Continuing from where I left in Part1 of this article, today I will try to elucidate the Metadata creation process. For the purpose of explanation, I will classify the Metadata in two distinct categories
a) Metadata that describes the Web Service functionality. In this category, we describe the data accepted by Web Service, data returned by Web Service and operations supported on the input data.
b) Metadata that describes the User experience. In this category, we describe the actions that the end user can execute on the data, menu items available to the user and organization of the UI elements in the task pane.
The focus today will be on describing the functionality offered by our Web Service using Metadata Explorer.
STEP 4: Use the Metadata explorer to create the Metadata to be published to the IBF Service.
IBF1.0 Solution Development guide advocates the use of the WSDLToMetadata tool, in order to generate the "base Metadata". This utility could definitely be used for complex solutions. Here, I would prefer "hand-coding" the metadata since the application we are developing is simple and straightforward.
a) Create a new Information Bridge Project named "GreetingServiceMetadata" as shown below

b) Now we will import the Metadata Template given below into the Metadata Explorer in order to facilitate the creation of the Metadata.
<?xml version="1.0" encoding="utf-8"?>
<Metadata xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="1.0.0.0" xmlns="http://schemas.microsoft.com/InformationBridge/2004/Metadata">
<MetadataScopes>
<MetadataScope Name="" DisplayName="" Version="1.0">
<Entities>
<Entity Name="">
<Views>
<View Name="" IsList="false">
<ViewLocators>
<ViewLocator ReferenceSchemaName="">
<OperationInstance OperationName="" Index="0">
<\OperationInstance>
</ViewLocator>
</ViewLocators>
</View>
</Views>
</Entity>
</Entities>
</MetadataScope>
</MetadataScopes>
</Metadata>
Copy the above XML into a file and save it as C:\MetadataTemplate.xml
In the Metadata Explorer, click ?[Import Metadata?]? and specify the file to be imported.

Select ?Replace? option in the next window.

c) Now let us expand the node labeled ?Metadata Scopes? and fill in the metadata details. Given below is the tree structure observed in the Metadata explorer after importing metadata from MetadataTemplate.xml.

First let us assign a name to the Metadata scope, entity and view element.
Right click the immediate child node of ?Metadata Scopes? and select Properties. This node is termed MetadataScope and is used to group logically related metadata elements. Assign the value ?http://InformationBridge/SayHello? to the Name property and the value ?SayHello? to the DisplayName property.
Right click the immediate child node of ?Entities? and select Properties. Set the Name property of this node to ?Friend?.
Right click the immediate child node of ?Views? and select Properties. Set the Name property of this node to ?GreetingMessage?.
Right click the ?Friend? entity & select Properties. Set the DefaultViewName property to the value ?GreetingMessage?.
Given below is the tree structure after these modifications.

d) The next step is to create Port elements to store the XML Schema definition for the Friend Entity and the GreetingMessage View. Here we shall use the schema definitions created in step 2(a) & 2(b).
1. Under the node labeled ?Ports?, double click [Add Port?] command.
2. In the ?Port Properties? tab, assign ?FriendPort? as the value for the Name property.
3. We will be using this port to supply the XML Schema definition of the Friend Entity. To make this known to IBF service, select ?Port File Xml? as the type of the port.
4. We will be saving the XML Schema definition directly to the metadata. Hence we select the radio button labeled ?Enter the XML port data to save in the metadata? and paste the FriendSchema definition created in step 2(a).
Given below is what we get after following the above steps.

Click the OK button to add FriendPort as one of the ports in our Metadata.
In a similar manner, using GreetingMessageSchema defined in Step 2(b), we create the port ?GreetingMessagePort? to supply the XML Schema definition for the View GreetingMessage.

e) Create a schema element corresponding to each of the ports created above.
1. In the Metadata explorer, under the node labeled ?Schemas?, double click ?[Add Schema?] command.
2. In the Add Schema dialog box, assign the value ?FriendSchema? to Name property.
3. In order to associate an XML Schema Definition with this element, select the Schema Type as ?Schema Xsd?.
4. Specify ?FriendPort? as the port that will supply the XSD. Given below is what we get by following the above steps

Click OK to add this schema definition into the Metadata.
Similary, create a schema element named ?GreetingMessageSchema? and bind it to the port ?GreetingMessagePort? as shown below.

Right click the ?Friend? entity & select Properties. Assign the schema name ?FriendSchema? to the property DefaultReferenceSchemaName of the ?Friend? entity.
Right click the ?GreetingMessage? view & select Properties. Assign the schema name ?GreetingMessageSchema? to the property SchemaName of the ?GreetingMessage? view.
f) At this stage, the Metadata contains all the information related to the data objects that will commute on this ?virtual Information Bridge? connecting Office applications to our Web Service. Now is the time to embed the Web Service details into our Metadata. So we will create a port that will supply the location of our Web Service.
1. Double click ?[Add Port?]? command.
2. Assign the value ?GreetingService? to the Name property.
3. The functionality provided by this port will be accessed through SOAP calls. Hence select ?Port SOAP? as the Port Type.
4. Assign the location of the Web Service created in STEP 3 to the Location property. Here the Location field takes the value ?http://localhost/IBFSimpleSolution/SayHello.asmx?.
Given below is what we have at the end of these steps.

Click OK to add this port definition to the Metadata.
g) Having defined the location of our Web Service, we now need to put in the details of the operations that our Web Service can perform on the data it receives. Specifically we will map the function GetGreetingMessage defined in step 3(d) to an operation element in the Metadata.
1. Double click [Add Operation?] command under the Operations node.
2. In the ?Operation Properties? tab, enter ?GetGreetingMessage? as the Name of the operation.
3. This operation will perform processing on the ?Friend? entity. Hence select the entity ?Friend? from the dropdown list.
4. Specify Timeout as 0, to use the default timeout defined on the IBF engine.
5. We want the operation GetGreetingMessage to be executed as a SOAP request. Hence we select OperationSoapRequest as the Type of this operation.
6. The function GetGreetingMessage defined in step 3(d) takes a Friend object as input. The Friend object is serialized as XML & sent over to the Web Service via HTTP. The XML representation of the Friend object should take the form defined by the ?FriendSchema? created in step 4(e). To make this known to the IBF service, click the ?Edit?? button associated with ?Input Schema? property and select ?FriendSchema? from the list.
7. The function GetGreetingMessage defined in step 3(d) returns a GreetingMessage object as input. The GreetingMessage object is serialized as XML & returned to the Office Application. The XML representation of the GreetingMessage object should confirm to the form defined by the ?GreetingMessageSchema? created in step 4(e). To feed this information in our Metadata, click the ?Edit?? button associated with ?Output Schema? property and select ?GreetingMessageSchema? from the list.
8. Assign the port name ?GreetingService? to the Port property of this operation to specify the location of the Web Service that contains the function, which maps to this operation.
9. Now we need to provide the URI that can be used to locate the Web Service function to be called when this operation is invoked. In the SOAPAction field, we specify the value as ?http://InformationBridge/SayHello/GetGreetingMessage?.
Given below is what we have at the end of these steps.

Click OK to add this operation to the Metadata.
10. Right click the operation element GetGreetingMessage and select properties.
Assign the value ?http://InformationBridge/SayHello:GetGreetingMessage? to the property SoapBodyWrapper.
With these changes, our Metadata now contains all the artifacts required to describe the Web Service functionality to the IBF client applications. The XML file created in this process can be viewed by opening MSIBFMetadata.xml
To complete Metadata, we still need to add information about how User Interface will be structured and what actions will be provided to the end user. We shall deal with these aspects in the next set of blogs.