Defining Applications

SharePoint has designed a structured metadata model to use so that you can map the necessary operations and fields for your business data in a way that SharePoint understands and does not require custom code. You will need to know what data you would like to make available from your application and how to access your data and application.

You can use the BDC to display data from database applications or applications that allow Web service access to the data.

Implementing your application

The structure of the metadata file that you will design for each data source follows the same hierarchy for every application. An application is a definition of a data source and the connection method used; each application can have multiple entities and associations, as described in subsequent sections. There is only one application defined in every metadata file, and it is defined using these tags:

  • LobSystem: This is the root-node container for metadata about your application. It contains all objects for that application, and there is only one LobSystem per application or XML file.

  • LobSystemInstance: This object contains the authentication and connection string information for your application, and there is only one LobSystemInstance per LOBSystem. Available authentication modes are:

    • PassThrough: This authentication method passes the user’s credentials to the database for authentication.

    • RevertToSelf: In this authentication scenario, IIS impersonates the Windows credentials of the user to gain database access.

    • RdbCredentials: This authentication mode tells SharePoint to use database credentials from SSO for the application.

    • WindowsCredentials: In WindowsCredentials authentication mode, SharePoint uses the Windows credentials from SSO.

To define the application and connection information for a sample SQL database, the XML would appear as follows:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<LobSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.microsoft.com/office/2006/03/
BusinessDataCatalog BDCMetadata.XSD" Type="Database"
Version="1.0.0.0" Name="AdventureWorksSample"
xmlns="http://schemas.microsoft.com/office/2006/03/
   BusinessDataCatalog">
<!-- The LobSystem name appears as the application name in the
   BDC administration. -->
  <Properties>
    <Property Name="WildcardCharacter" Type="System.String">%</
       Property>
    <!-- Insert the wildcard character that your application uses
    in this property. -->
  </Properties>
  <LobSystemInstances>
    <LobSystemInstance Name="AdventureWorksSampleInstance">
      <!-- This instance name is what end users see when
         selecting Business Data types.-->
      <Properties>
        <Property Name="AuthenticationMode"
Type="System.String">PassThrough</Property>
        <!--AuthenticationMode can be set to PassThrough,
        RevertToSelf, RdbCredentials, or WindowsCredentials. -->
        <Property Name="DatabaseAccessProvider"
Type="System.String">SqlServer</Property>
        <!-- Options are SQL Server, OLEDB, Oracle, or ODBC for
           database
        systems. -->
        <Property Name="RdbConnection Data Source" Type=
           "System.String">ServerName</Property>
        <!-- If you are connecting to an instance use format
           servernameinstance -->
        <Property Name="RdbConnection Initial Catalog"
Type="System.String">DatabaseName</Property>
        <Property Name="RdbConnection Integrated Security"
Type="System.String">SSPI</Property>
        <Property Name="RdbConnection Pooling"
Type="System.String">false</Property>
      </Properties>
    </LobSystemInstance>
  </LobSystemInstances>
  <!-- There can be only one Lobsysteminstance per lobsystem -->
  <Entities>
  <!-- Enter your entity or entities here -->
  </Entities>
  <Associations>
  <!-- Enter your associations here -->
  </Associations>
</LobSystem>

Defining your entities

Entities are logical groupings of data from your application that you will be making available via the BDC. Examples of entities would be customers (for which you pull several fields like first name, last name, e-mail, and so on) or orders (including order date, customer name, and total price). Using the metadata attributes for the entity object, you describe what fields are returned, which are used to filter the data in SharePoint, how the object is returned, what actions are possible, and if there are associated entities. The following components make up an entity:

  • Identifier: The key or keys used to uniquely identify an instance of the entity.

  • Method: The method used to get data from the source. This is the equivalent of a select statement in SQL, and in fact, if your data source is SQL Server, you will most likely be using a select statement.

    • FilterDescriptor: The filter descriptors define the fields available for users to filter the data in the BDC.

    • Parameter: The parameters work hand in hand with the filter descriptor to describe what parameters will be passed to the BDC to find data and what fields are returned for the data. Each parameter has a type descriptor to describe the expected data.

    • MethodInstance: This parameter describes how to call the method by defining the input parameter that the method takes and default values. A method may have more than one MethodInstance so that it can be called using different default values.

  • Action: The action tags describe what actions are presented to the user for the data. An action can be anything that is URL-addressable (Web link, mailto tag, and so on) and will be visible anywhere the entity is referenced, whether in a list field or in a business data Web Part. Actions should be used to help drive the user to interact with the data.

    • ActionParameter: This parameter defines the parameters that the action URL can accept.

Here is some sample code to show how to define entities, methods, filters, parameters, and actions:

<Entity Name="Items">
  <!-- EntityName will show in the business data type field
     of business data web parts-->
  <Properties>
    <Property Name="Title" Type="System.String">ItemName</
       Property>
    <!-- This property will define what field is shown in the
       picker for an item of this type. Type defines the type
       of field it is. -->
  </Properties>
  <Identifiers>
    <Identifier Name="ItemID" TypeName="System.Int32" />
    <!-- Identifiers are the items that define a unique
       entity instance. An entity may have more than one
       identifier to define uniqueness. -->
  </Identifiers>
  <Methods>
    <!-- Methods define how to pull the data from the data
       source. -->
    <Method Name="GetItems">
      <Properties>
        <Property Name="RdbCommandText" Type="System.String">
          SELECT ItemID, ItemName, ItemNumber, ItemDescription,
             ItemCost, CreateDate FROM x WHERE x
 <!-- this property defines the select statement to gather
    your fields. -->
        </Property>
        <Property Name="RdbCommandType" Type="System.Data.
           CommandType">Text</Property>
        <!-- Possible values for database commands are Text,
           StoredProcedure, or TableDirect. -->
      </Properties>
      <FilterDescriptors>
        <!-- Filters define ways that are valid with your
           data to help users select the appropriate records.
           Each "in" parameter direction below requires an
           associated filter to be defined in this section. -->
        <FilterDescriptor Type="Comparison" Name="ID" />
        <FilterDescriptor Type="Wildcard" Name="ItemName">
          <Properties>
            <Property Name="UsedForDisambiguation" Type=
               "System.Boolean">true</Property>
            <!-- The UsedForDisambiguation property allows
               the BDC to select between multiple items if
               they are returned from one search. This is an
               optional property.-->
          </Properties>
        </FilterDescriptor>
        <FilterDescriptor Type="Wildcard" Name="ItemNumber" />
      </FilterDescriptors>
      <Parameters>
        <Parameter Direction="In" Name="@MinItemID">
          <TypeDescriptor TypeName="System.Int32"
             IdentifierName="ItemtID" AssociatedFilter="ID"
             Name="MinItemID">
            <!-- The AssociatedFilter attribute is required
               for input parameters. Because this
               typedescriptor is the identifier for the
               entity, identifiername is required. -->
            <DefaultValues>
             <DefaultValue MethodInstanceName=
                "ItemFinderInstance" Type="System.Int32">0</
                DefaultValue>
     (!-- See MethodInstance section at end of method. -->
           </DefaultValues>
         </TypeDescriptor>
       </Parameter>
       <Parameter Direction="In" Name="@MaxItemProductID">
         <TypeDescriptor TypeName="System.Int32"
            IdentifierName="ItemID" AssociatedFilter="ID"
            Name="MaxItemID">
           <DefaultValues>
             <DefaultValue MethodInstanceName=
                "ItemFinderInstance" Type="System.
                Int32">99999999</DefaultValue>
           </DefaultValues>
         </TypeDescriptor>
       </Parameter>
       <!-- enter a parameter and nested typedescriptors for
          all types of data that you would like users to be
          able to enter to find data. -->
       <Parameter Direction="Return" Name="Items">
<!-- The return parameters define what columns are returned
   to the user and how they are defined. -->
         <TypeDescriptor TypeName="System.Data.IDataReader,
            System.Data, Version=2.0.3600.0, Culture=
            neutral, PublicKeyToken=b77a5c561934e089"
            IsCollection="true" Name="ItemDataReader">
           <TypeDescriptors>
             <TypeDescriptor TypeName="System.Data.
                IDataRecord, System.Data, Version=2.0.3600.0,
                Culture=neutral, PublicKeyToken=
                b77a5c561934e089" Name="ItemDataRecord">
               <TypeDescriptors>
                 <TypeDescriptor TypeName="System.Int32"
                    IdentifierName="ItemID" Name="ItemID">
                   <!-- The IdentifierName attribute for
                      typedescriptors that are identifiers.
                      Do not use the associatedfilter
                      parameter in return parameters. -->
                   <LocalizedDisplayNames>
                     <LocalizedDisplayName LCID="1033">ID</
                        LocalizedDisplayName>
                   </LocalizedDisplayNames>
                 </TypeDescriptor>
                 <TypeDescriptor TypeName="System.String"
                    Name="ItemName" >
                   <LocalizedDisplayNames>
                     <LocalizedDisplayName LCID="1033">
                        ItemName</LocalizedDisplayName>
                   </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.Decimal"
                         Name="ItemNumber">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Item
                             Number</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.DateTime"
                         Name="Create Date">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">
                             Create Date</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
            <!-- Enter as many typedescriptors as you would like
               for fields to be returned. -->
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance Name="ItemFinderInstance" Type=
               "Finder" ReturnParameterName="Items" />
      <!-- The finder instance will return multiple items that
         match the criteria and method for a given lookup on the
         data. -->
            <MethodInstance Name="ItemSpecificFinderInstance"
               Type="SpecificFinder" ReturnParameterName="Items" />
<!-- The specificfinder instance will return only one item that
   matches the criteria and method for a given lookup on the
   data. -->
          </MethodInstances>
        </Method>
        <Method Name="ItemIDEnumerator">
          <!-- This method if you want to enable search of this
             data. This method returns a list of IDs to be
             indexed.-->
          <Properties>
            <Property Name="RdbCommandText" Type="System.String">
               SELECT ItemID FROM x WHERE ItemID &gt; 0 AND
               ItemID &lt; 1000</Property>
            <Property Name="RdbCommandType" Type="System.String">
               Text</Property>
          </Properties>
          <Parameters>
     <!-- No input parameters are necessary because this method
        is only used by search. -->
            <Parameter Name="ItemIDs" Direction="Return">
             <TypeDescriptor TypeName="System.Data.IDataReader,
                System.Data, Version=2.0.3600.0, Culture=neutral,
                 PublicKeyToken=b77a5c561934e089" IsCollection=
                "true" Name="Item">
               <TypeDescriptors>
                 <TypeDescriptor TypeName="System.Data.
                    IDataRecord, System.Data, Version=2.0.3600.0,
                    Culture=neutral, PublicKeyToken=
                    b77a5c561934e089" Name="Item">
                   <TypeDescriptors>
                     <TypeDescriptor TypeName="System.Int32"
                        IdentifierName="ItemID" Name="ItemID">
                       <LocalizedDisplayNames>
                         <LocalizedDisplayName LCID="1033">ID</
                            LocalizedDisplayName>
                       </LocalizedDisplayNames>
                     </TypeDescriptor>
                   </TypeDescriptors>
                 </TypeDescriptor>
               </TypeDescriptors>
             </TypeDescriptor>
           </Parameter>
         </Parameters>
         <MethodInstances>
           <MethodInstance Name="ItemIDEnumeratorInstance" Type=
              "IdEnumerator" ReturnParameterName="ItemIDs" />
         </MethodInstances>
       </Method>
<Method>
<!-- Enter as many methods as necessary for your entity. You may
  want to enter methods to support associations so they would
  establish the relationship between parent and child objects so
  that the method pulls all child objects for parent=x. -->
</Method>
     </Methods>
     <Actions>
      <Action Name="Display" Position="1" IsOpenedInNewWindow=
         "true"
              Url="http://sample.avitivacorp.com/lists/new/
                 dispform.aspx?ID={0}" ImageUrl="">
       <ActionParameters>
        <ActionParameter Name="Name" Index="0" />
       </ActionParameters>
      </Action>
     </Actions>
   </Entity>
   <Entity EstimatedInstanceCount="10000" Name="Item2">
   <!-- Enter as many entities as appropriate for your lobsystem
      instance. The EstimatedInstanceCount parameter is optional.
   </Entity>

Defining associations

Associations are used to link relationships between entities in a parent-child type relationship. The business data-related link Web Part uses the association definition to select the related child objects given the parent entity object. For example, a parent entity would be a customer, a child entity would be orders, and the relationship would define how to find the orders given the identity of the customer.

Another optional component for your BDC definition is to define associations. Associations are related entities within your source application, and if you think of the entity as the parent, the associations are the children of that parent. For example, a customer is your entity and the contacts for that customer are the associations. By defining associations, you can create applications that show related details for an entity.

An example of the XML used to create an association is

<Association AssociationMethodEntityName="Entity1"
   AssociationMethodName="Method3" Association
   MethodReturnParameterName="Items" Name="Entity1ToEntity2"
   IsCached="true">
  <!-- The association defines the relationship between
     parent and child entities. The associationmethodentity
     name tells where to find the method. The association
     methodname is the method used to define the
     relationship. -->
  <SourceEntity Name="Entity1" />
  <DestinationEntity Name="Entity2" />
  <!-- The source contains the parent and the destination
     contains the child. The source and destination entities
     can be the same. -->
</Association>

BDC application examples

To help illustrate the XML application definition file for different types of data sources, we present two examples of application definitions. These examples give specific implementation details to help showcase the metadata model the BDC provides. The first is an application definition for data in a SQL Server database. The second is an application definition that uses Web services to access data in a SharePoint list and in an SQL database.

Tip

For more examples, Microsoft provides template files for BDC applications in the SharePoint installation. Browse to the %program files%Microsoft Office Server12.0BinBusinessDataCatalog directory to find examples for SAP 4.7, SAP 6.40, and Siebel 7.8.


BDC application example to define SQL database data

This application file defines two entities, contacts and orders, from the AdventureWorks sample SQL database. The contacts entity has three associated methods. The first gets the contacts, the second gets orders for a contact, and the third enumerates the contacts so they are searchable. The orders entity has only two associated methods—one to get the orders and the second to enumerate the orders so that they are searchable. The two entities have one association that links multiple orders to a single contact.

The sample code for the example looks like this:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<LobSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://schemas.microsoft.com/office/2006/
   03/BusinessDataCatalog BDCMetadata.xsd" Type="Database"
   Version="1.0.0.22" Name="AdventureWorks" xmlns=
   "http://schemas.microsoft.com/office/2006/03/
   BusinessDataCatalog">
  <Properties>
    <Property Name="WildcardCharacter" Type="System.String">%</
       Property>
 </Properties>
  <LobSystemInstances>
    <LobSystemInstance Name="AdventureWorks Sample">
      <Properties>
        <Property Name="Authentication Mode" Type="System.
           String">PassThrough</Property>
         <Property Name="DatabaseAccessProvider" Type="System.
            String">SqlServer</Property>
        <Property Name="RdbConnection Data Source" Type="System.
           String">servername</Property>
        <Property Name="RdbConnection Initial Catalog" Type=
           "System.String">AdventureWorks</Property>
        <Property Name="RdbConnection Integrated Security" Type=
           "System.String">SSPI</Property>
       <Property Name="RdbConnection Pooling" Type="System.
          String">false</Property>
      </Properties>
    </LobSystemInstance>
  </LobSystemInstances>
  <Entities>
    <Entity EstimatedInstanceCount="10000" Name="Orders">
      <Properties>
        <Property Name="Title" Type="System.String">ID</Property>
      </Properties>
      <Identifiers>
        <Identifier TypeName="System.Int32" Name="SalesOrderID" />
      </Identifiers>
      <Methods>
        <Method Name="GetOrders">
          <Properties>
            <Property Name="RdbCommandText" Type="System.String">
                        Select
                        SalesOrderID
                        , OrderDate
                         , SalesOrderNumber
                         , ContactID
                          , TotalDue
                          from dbo.SalesOrder
                          where (SalesOrderID &gt;=
                             @MinSalesOrderID) and (SalesOrderID
                             &lt;=@MaxSalesOrderID)
                        and (SalesOrderNumber LIKE
                          @SalesOrderNumber)
                </Property>
            <Property Name="RdbCommandType" Type="System.Data.
               CommandType, System.Data, Version=2.0.0.0,
               Culture=neutral, PublicKeyToken=b77a5c561934e089">
               Text</Property>
          </Properties>
          <FilterDescriptors>
            <FilterDescriptor Type="Comparison" Name="ID" />
            <FilterDescriptor Type="Wildcard" Name=
               "SalesOrderNumber" />
          </FilterDescriptors>
          <Parameters>
            <Parameter Direction="In" Name="@MinSalesOrderID">
              <TypeDescriptor TypeName="System.Int32"
                 IdentifierName="SalesOrderID" AssociatedFilter=
                 "ID" Name="MinSalesOrderID">
                <DefaultValues>
                  <DefaultValue MethodInstanceName=
                     "OrderFinderInstance" Type="System.Int32"
                     >0</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In" Name="@MaxSalesOrderID">
              <TypeDescriptor TypeName="System.Int32"
                 IdentifierName="SalesOrderID" AssociatedFilter=
                 "ID" Name="MaxSalesOrderID">
                <DefaultValues>
                  <DefaultValue MethodInstanceName=
                     "OrderFinderInstance" Type="System.Int32"
                     >9999999</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="In" Name="@SalesOrderNumber">
              <TypeDescriptor TypeName="System.String"
                 AssociatedFilter="SalesOrderNumber" Name=
                 "SalesOrderNumber">
                <DefaultValues>
                  <DefaultValue MethodInstanceName=
                     "OrderFinderInstance" Type="System.String"
                     >%</DefaultValue>
                  <DefaultValue MethodInstanceName=
                     "OrderSpecificFinderInstance" Type=
                     "System.String">%</DefaultValue>
                </DefaultValues>
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="Return" Name="Orders">
              <TypeDescriptor TypeName="System.Data.IDataReader,
                 System.Data, Version=2.0.3600.0, Culture=neutral,
                 PublicKeyToken=b77a5c561934e089" IsCollection=
                 "true" Name="OrderDataReader">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="System.Data.
                     IDataRecord, System.Data, Version=2.0.3600.0,
                     Culture=neutral, PublicKeyToken=
                     b77a5c561934e089" Name="OrderDataRecord">
                    <TypeDescriptors>
                      <TypeDescriptor TypeName="System.Int32"
                         IdentifierName="SalesOrderID" Name=
                         "SalesOrderID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">ID</
                             LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property Name="DisplayByDefault" Type=
                             "System.Boolean">true</Property>
                          <!-- DisplayByDefault is optional. If
                             it is not specified, the field will
                             still be available as a web part or
                             list selection. -->
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.DateTime"
                         Name="OrderDate">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033"
                             >OrderDate</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.Int32"
                         Name="ContactID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033"
                             >ContactID</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.String"
                         Name="SalesOrderNumber">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Sales
                             OrderNumber</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.Decimal"
                         Name="TotalDue">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033"
                             >TotalDue</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance Type="Finder" ReturnParameterName=
               "Orders" Name="OrderFinderInstance">
               </MethodInstance>
            <MethodInstance Type="SpecificFinder"
               ReturnParameterName="Orders" Name="OrderSpecific
               FinderInstance">            </MethodInstance>
          </MethodInstances>
        </Method>
        <Method Name="OrderIDEnumerator">
          <Properties>
            <Property Name="RdbCommandText" Type=
               "System.String">SELECT SalesOrderID FROM
               dbo.SalesOrder WHERE SalesOrderID &gt; 40000 AND
               SalesOrderID &lt; 60000</Property>
            <Property Name="RdbCommandType" Type="System.String"
               >Text</Property>
          </Properties>
          <Parameters>
            <Parameter Name="SalesOrderIDs" Direction="Return">
              <TypeDescriptor TypeName="System.Data.IDataReader,
                 System.Data, Version=2.0.3600.0, Culture=
                 neutral, PublicKeyToken=b77a5c561934e089"
                 IsCollection="true" Name="Orders">
                 <TypeDescriptors>
                   <TypeDescriptor TypeName="System.Data.
                      IDataRecord, System.Data, Version=2.0.3600.0,
                      Culture=neutral, PublicKeyToken=
                      b77a5c561934e089" Name="Orders">
                     <TypeDescriptors>
                       <TypeDescriptor TypeName="System.Int32"
                          IdentifierName="SalesOrderID" Name=
                          "SalesOrderID">
                         <LocalizedDisplayNames>
                           <LocalizedDisplayName LCID=
                              "1033">ID</LocalizedDisplayName>
                         </LocalizedDisplayNames>
                       </TypeDescriptor>
                     </TypeDescriptors>
                   </TypeDescriptor>
                 </TypeDescriptors>
               </TypeDescriptor>
             </Parameter>
           </Parameters>
           <MethodInstances>
             <MethodInstance Name="SalesOrderIDEnumeratorInstance"
                Type="IdEnumerator" ReturnParameterName=
                "SalesOrderIDs" />
           </MethodInstances>
         </Method>
       </Methods>
     </Entity>
     <Entity EstimatedInstanceCount="10000" Name="Contact">
       <Properties>
         <Property Name="Title" Type="System.String">LastName</
            Property>
         <Property Name="DefaultAction" Type="System.String">
            View Profile</Property>
       </Properties>
       <Identifiers>
         <Identifier TypeName="System.Int32" Name="ContactID" />
       </Identifiers>
       <Methods>
         <Method Name="GetContacts">
           <Properties>
             <Property Name="RdbCommandText" Type="System.String">
                        select
                        ContactID
                        , FirstName
                        , LastName
                        , EmailAddress
                        , Phone
                        from person.contact
                        where (ContactID &gt;=@MinContactID) and
                           (ContactID &lt;=@MaxContactID) AND
                           (LastName LIKE @LastName) AND
                           (FirstName LIKE @FirstName)
                 </Property>
             <Property Name="RdbCommandType" Type="System.Data.
                CommandType, System.Data, Version=2.0.0.0,
                Culture=neutral, PublicKeyToken=b77a5c561934e089"
                >Text</Property>
           </Properties>
           <FilterDescriptors>
             <FilterDescriptor Type="Comparison" Name="ID" />
             <FilterDescriptor Type="Wildcard" Name="LastName">
               <Properties>
                 <Property Name="UsedForDisambiguation" Type=
                    "System.Boolean">true</Property>
                <Property Name="IsDefault" Type="System.Boolean"
                   >true</Property>
               </Properties>
             </FilterDescriptor>
             <FilterDescriptor Type="Wildcard" Name="FirstName">
               <Properties>
                 <Property Name="UsedForDisambiguation" Type=
                    "System.Boolean">true</Property>
                </Properties>
              </FilterDescriptor>
            </FilterDescriptors>
            <Parameters>
              <Parameter Direction="In" Name="@MinContactID">
                <TypeDescriptor TypeName="System.Int32"
                   IdentifierName="ContactID" AssociatedFilter="ID"
                   Name="MinContactID">
                  <DefaultValues>
                    <DefaultValue MethodInstanceName=
                       "ContactFinderInstance" Type="System.
                       Int32">0</DefaultValue>
                  </DefaultValues>
                </TypeDescriptor>
              </Parameter>
              <Parameter Direction="In" Name="@MaxContactID">
                <TypeDescriptor TypeName="System.Int32"
                   IdentifierName="ContactID" AssociatedFilter="ID"
                   Name="MaxContactID">
                  <DefaultValues>
                    <DefaultValue MethodInstanceName=
                       "ContactFinderInstance" Type="System.Int32"
                       >9999999</DefaultValue>
                  </DefaultValues>
                </TypeDescriptor>
              </Parameter>
              <Parameter Direction="In" Name="@LastName">
                <TypeDescriptor TypeName="System.String"
                   AssociatedFilter="LastName" Name="LastName">
                  <DefaultValues>
                    <DefaultValue MethodInstanceName=
                       "ContactFinderInstance" Type=
                       "System.String">%</DefaultValue>
                    <DefaultValue MethodInstanceName=
                       "ContactSpecificFinderInstance" Type=
                       "System.String">%</DefaultValue>
                  </DefaultValues>
                </TypeDescriptor>
              </Parameter>
              <Parameter Direction="In" Name="@FirstName">
                <TypeDescriptor TypeName="System.String"
                   AssociatedFilter="FirstName" Name="FirstName">
                  <DefaultValues>
                    <DefaultValue MethodInstanceName=
                       "ContactFinderInstance" Type="System.String"
                       >%</DefaultValue>
                    <DefaultValue MethodInstanceName=
                       "ContactSpecificFinderInstance" Type=
                       "System.String">%</DefaultValue>
                  </DefaultValues>
                </TypeDescriptor>
              </Parameter>
              <Parameter Direction="Return" Name="Contacts">
                <TypeDescriptor TypeName="System.Data.IDataReader,
                   System.Data, Version=2.0.3600.0, Culture=neutral,
                   PublicKeyToken=b77a5c561934e089" IsCollection=
                   "true" Name="ContactDataReader">
                  <TypeDescriptors>
                    <TypeDescriptor TypeName="System.Data.
                       IDataRecord, System.Data, Version=
                       2.0.3600.0, Culture=neutral,
                       PublicKeyToken=b77a5c561934e089" Name=
                       "ContactDataRecord">
                      <TypeDescriptors>
                        <TypeDescriptor TypeName="System.Int32"
                           IdentifierName="ContactID" Name=
                           "ContactID">
                          <LocalizedDisplayNames>
                           <LocalizedDisplayName LCID=
                              "1033">ID</LocalizedDisplayName>
                         </LocalizedDisplayNames>
                         <Properties>
                           <Property Name="DisplayByDefault" Type=
                              "System.Boolean">true</Property>
                         </Properties>
                       </TypeDescriptor>
                       <TypeDescriptor TypeName="System.String"
                          Name="FirstName">
                         <LocalizedDisplayNames>
                           <LocalizedDisplayName LCID="1033"
                              >FirstName</LocalizedDisplayName>
                         </LocalizedDisplayNames>
                         <Properties>
                           <Property Name="DisplayByDefault" Type=
                              "System.Boolean">true</Property>
                         </Properties>
                       </TypeDescriptor>
                       <TypeDescriptor TypeName="System.String"
                          Name="LastName">
                         <LocalizedDisplayNames>
                           <LocalizedDisplayName LCID="1033"
                              >LastName</LocalizedDisplayName>
                         </LocalizedDisplayNames>
                         <Properties>
                           <Property Name="DisplayByDefault" Type=
                              "System.Boolean">true</Property>
                         </Properties>
                       </TypeDescriptor>
                       <TypeDescriptor TypeName="System.String"
                          Name="EmailAddress">
                         <LocalizedDisplayNames>
                           <LocalizedDisplayName LCID="1033"
                              >EmailAddress</LocalizedDisplayName>
                         </LocalizedDisplayNames>
                       </TypeDescriptor>
                       <TypeDescriptor TypeName="System.String"
                          Name="Phone">
                         <LocalizedDisplayNames>
                           <LocalizedDisplayName LCID="1033"
                              >Phone</LocalizedDisplayName>
                         </LocalizedDisplayNames>
                       </TypeDescriptor>
                     </TypeDescriptors>
                   </TypeDescriptor>
                 </TypeDescriptors>
               </TypeDescriptor>
             </Parameter>
           </Parameters>
           <MethodInstances>
             <MethodInstance Type="Finder" ReturnParameterName=
                "Contacts" Name="ContactFinderInstance">
                </MethodInstance>
             <MethodInstance Type="SpecificFinder"
                ReturnParameterName="Contacts" Name=
                "ContactSpecificFinderInstance">
                </MethodInstance>
           </MethodInstances>
         </Method>
        <Method Name="GetSalesOrdersForContacts">
          <Properties>
            <Property Name="RdbCommandText" Type="System.String">
                       select
                       SalesOrderID
                       , OrderDate
                       , SalesOrderNumber
                       , ContactID
                       , TotalDue
from dbo.salesorder
               where ContactID = Expr1 AND ContactID = @ContactID
                  </Property>
            <Property Name="RdbCommandType" Type=
               "System.Data.CommandType, System.Data, Version=
               2.0.0.0, Culture=neutral, PublicKeyToken=
               b77a5c561934e089">Text</Property>
          </Properties>
          <Parameters>
            <Parameter Direction="In" Name="@ContactID">
              <TypeDescriptor TypeName="System.Int32"
                 IdentifierName="ContactID" Name="ContactID">
              </TypeDescriptor>
            </Parameter>
            <Parameter Direction="Return" Name="Orders">
              <TypeDescriptor TypeName="System.Data.IDataReader,
                 System.Data, Version=2.0.3600.0, Culture=
                 neutral, PublicKeyToken=b77a5c561934e089"
                 IsCollection="true" Name="OrderDataReader">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="System.Data.
                     IDataRecord, System.Data, Version=2.0.3600.0,
                     Culture=neutral, PublicKeyToken=
                     b77a5c561934e089" Name="OrderDataRecord">
                    <TypeDescriptors>
                      <TypeDescriptor TypeName="System.Int32"
                         IdentifierEntityName="Orders"
                         IdentifierName="SalesOrderID" Name=
                         "SalesOrderID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">ID</
                             LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property Name="DisplayByDefault" Type=
                             "System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.DateTime"
                         Name="OrderDate">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033"
                             >OrderDate</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property Name="DisplayByDefault" Type=
                             "System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.Int32"
                         Name="ContactID">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033"
                             >ContactID</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.String"
                         Name="SalesOrderNumber">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033">Sales
                             OrderNumber</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                      </TypeDescriptor>
                      <TypeDescriptor TypeName="System.Decimal"
                         Name="TotalDue">
                        <LocalizedDisplayNames>
                          <LocalizedDisplayName LCID="1033"
                             >TotalDue</LocalizedDisplayName>
                        </LocalizedDisplayNames>
                        <Properties>
                          <Property Name="DisplayByDefault" Type=
                             "System.Boolean">true</Property>
                        </Properties>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
        </Method>
      </Methods>
    </Entity>
  </Entities>
    <Associations>
    <Association AssociationMethodEntityName="Contact"
       AssociationMethodName="GetSalesOrdersForContacts"
       AssociationMethodReturnParameterName="Orders" Name=
       "ContacttoOrders" IsCached="true">
      <SourceEntity Name="Contact" />
      <DestinationEntity Name="Orders" />
    </Association>
  </Associations>
</LobSystem>

Application definition using Web services

This application uses a Web service to access business data for two entities, one for solutions and one for metadata. The solutions data is stored in an SQL database. The metadata data is stored in a SharePoint list that has these columns:

  • Title: Single line of text

  • Related resource URL: Hyperlink

  • Solution ID: Business data

  • Related Resource Type: Lookup (to other SharePoint list)

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<LobSystem
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://schemas.microsoft.com/
     office/2006/03/BusinessDataCatalog bdcMetadata.xsd"
  Type="WebService"
  Version="1.0.0.18"
  Name="OSSDData"
  xmlns="http://schemas.microsoft.com/office/2006/03/BusinessData
     Catalog">

  <Properties>

    <Property Name="WebServiceProxyNamespace" Type=
       "System.String">OSSDDataProxy</Property>
    <Property Name="WildcardCharacter" Type="System.String"
       >$</Property>
    <Property Name="WsdlFetchUrl" Type="System.String">
      http://servername/WebServices/Service1/listname.asmx
    </Property> <!-- This URL points to the web service of your
       list -->

  </Properties>

  <LobSystemInstances>
    <LobSystemInstance Name="OSSDDataService">

      <Properties>
        <Property Name="LobSystemName" Type="System.String"
           >OSSDData</Property>
      </Properties>
    </LobSystemInstance>
  </LobSystemInstances>

  <Entities>
    <Entity Name="Solution" EstimatedInstanceCount="10000">
      <Properties>
        <Property Name="Title" Type="System.String"
           >SolutionName</Property>
      </Properties>
      <Identifiers>
        <Identifier Name="SolutionId" TypeName="System.String">
           </Identifier>
      </Identifiers>
      <Methods>
        <Method Name="GetSolutionIds">

          <Parameters>
            <Parameter Direction="Return" Name="SolutionIds">
              <TypeDescriptor TypeName="System.String[]" Name=
                 "ArrayOfString">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="System.String" Name=
                     "SolutionId" IdentifierName="SolutionId">
                     </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>

          <MethodInstances>
            <MethodInstance Type="IdEnumerator" ReturnParameter
               Name="SolutionIds" ReturnTypeDescriptorName=
               "ArrayOfString" ReturnTypeDescriptorLevel="0"
               Name="GetSolutionIdsInstance" />
          </MethodInstances>

        </Method>
        <Method Name="GetSolutions">
          <FilterDescriptors>
            <FilterDescriptor Type="Wildcard" Name="SolutionName" />
          </FilterDescriptors>
          <Parameters>
            <Parameter Direction="In" Name="SolutionName">
              <TypeDescriptor TypeName="System.String" Associated
                 Filter="SolutionName" Name="SolutionName" />
            </Parameter>
            <Parameter Direction="Return" Name="Solutions">
              <TypeDescriptor TypeName="OSSDDataProxy.
                 OSSDSolution[], OSSDData" IsCollection="true"
                 Name="ArrayOfOSSDSolution">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="OSSDDataProxy.
                     OSSDSolution, OSSDData" Name="OSSDSolution">
                    <TypeDescriptors>

                      <TypeDescriptor TypeName="System.String"
                         IdentifierName="SolutionId" Name=
                         "SolutionId"></TypeDescriptor>
                      <TypeDescriptor TypeName="System.String"
                         Name="SolutionName"></TypeDescriptor>

                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>

            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance Type="Finder" ReturnParameterName=
               "Solutions" ReturnTypeDescriptorName=
               "ArrayOfOSSDSolution" ReturnTypeDescriptorLevel=
               "0" Name="GetSolutionsInstance" />
          </MethodInstances>
        </Method>
        <Method Name="GetSolutionById">

          <Parameters>
            <Parameter Direction="In" Name="SolutionId">
              <TypeDescriptor TypeName="System.String"
                 IdentifierName="SolutionId" Name="SolutionId">
                 </TypeDescriptor>
            </Parameter>
            <Parameter Direction="Return" Name="OSSDSolution">
              <TypeDescriptor TypeName="OSSDDataProxy.
                 OSSDSolution, OSSDData" Name="OSSDSolution">
                <TypeDescriptors>

                  <TypeDescriptor TypeName="System.String"
                     IdentifierName="SolutionId" Name=
                        "SolutionId"></TypeDescriptor>
                  <TypeDescriptor TypeName="System.String" Name=
                     "SolutionName"></TypeDescriptor>

                </TypeDescriptors>
              </TypeDescriptor>
            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance Type="SpecificFinder" Return
               ParameterName="OSSDSolution" ReturnType
               DescriptorName="OSSDSolution" ReturnTypeDescriptor
               Level="0" Name="GetSolutionByIdInstance" />
          </MethodInstances>
        </Method>
      </Methods>

    </Entity>
    <Entity Name="MetaData" EstimatedInstanceCount="10000">
      <Properties>
        <Property Name="Title" Type="System.String">Description</
           Property>
      </Properties>
      <Identifiers>
        <Identifier Name="SolutionName" TypeName="System.String">
           </Identifier>
      </Identifiers>
      <Methods>

        <Method Name="GetMetaData">
          <FilterDescriptors>
           <FilterDescriptor Type="Wildcard" Name="SolutionName" />
          </FilterDescriptors>
          <Parameters>
            <Parameter Direction="In" Name="SolutionName">
              <TypeDescriptor TypeName="System.String"
                 AssociatedFilter="SolutionName" Name=
                 "SolutionName" />
            </Parameter>
            <Parameter Direction="Return" Name="MetaData">
              <TypeDescriptor TypeName="OSSDDataProxy.
                 OSSDMetaData[], OSSDData" IsCollection="true"
                 Name="ArrayOfOSSDMetaData">
                <TypeDescriptors>
                  <TypeDescriptor TypeName="OSSDDataProxy.
                     OSSDMetaData, OSSDData" Name="OSSDMetaData">
                    <TypeDescriptors>

                      <TypeDescriptor TypeName="System.String"
                         Name="SolutionId"></TypeDescriptor>
                      <TypeDescriptor TypeName="System.String"
                         Name="RelatedResource"></TypeDescriptor>
                      <TypeDescriptor TypeName="System.String"
                         Name="SolutionName" IdentifierName=
                         "SolutionName" ></TypeDescriptor>
                      <TypeDescriptor TypeName="System.String"
                         Name="Description"></TypeDescriptor>
                      <TypeDescriptor TypeName="System.String"
                         Name="Title"></TypeDescriptor>
                      <TypeDescriptor TypeName="System.String"
                         Name="Url"></TypeDescriptor>

                    </TypeDescriptors>
                  </TypeDescriptor>
                </TypeDescriptors>
              </TypeDescriptor>

            </Parameter>
          </Parameters>
          <MethodInstances>
            <MethodInstance Type="Finder" ReturnParameterName=
                  "MetaData" ReturnTypeDescriptorName=
                  "ArrayOfOSSDMetaData" ReturnTypeDescriptor
                  Level="0" Name="GetMetaDataInstance" />
          </MethodInstances>
        </Method>
      </Methods>

    </Entity>
  </Entities>
</LobSystem>

Adding the application definition to the BDC

After you have created your application definition, you need to import the application definition to the BDC. During the import process, SharePoint provides XML error checking. If the import fails, you are provided with a reason and location of the failure for you to correct. To import an application definition to the BDC, follow these steps:

1.
Open the Shared Services Provider (SSP) administration page.

2.
Select Import application definition from the Business Data Catalog section.

3.
Browse to your XML definition file and click Import.

Tip

If you have a non-XML-related problem with your application definition (like an error in your select statement), you can still upload your XML file, but you will receive errors when you try to access the BDC objects. To troubleshoot these errors, review the application log on the SharePoint server Event Viewer.


Updating the BDC application definition

To update an application that you have already defined, you must delete the previous definition. You do this by following these steps:

1.
Open the SSP administration page.

2.
Select View applications from the Business Data Catalog section.

3.
Select the application that you would like to delete and click Delete Application in the Application Settings section, as shown in Figure 17.1.

Figure 17.1. Deleting an application definition


4.
Proceed with adding your new application definition file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset