Authoring Step 4: Define the Address External ContentType

Authoring Step 4: Define the Address External ContentType

Last modified: April 16, 2010

Applies to: SharePoint Server 2010

At its basic level, an external content type consists of a title (defined in the Properties element), a unique identifier (which equates to a primary key), and methods that are used to define the fields of an entity and tell the Business Data Connectivity (BDC) service how to pull data out of the external system.

In the case of databases, a BDC method contains a Properties element that defines the database query, a Parameters element that defines the data returned from the query, and a MethodInstances element that defines the different ways the method can be called. However, in the case of Web services, a method describes the Web method that should be invoked to get the desired data. The method name should match the Web method name and the Parameters element defines the data returned from the Web method; a MethodInstances element defines the different ways that the method can be called. All names and types should match the names and types in the Web services proxy.

In this step, you define an external content type named Address. The Address entity in the SampleWebService proxy demonstrates a scenario in which it is acceptable not to define an identifier for the entity. This is because we just want to display a list of addresses for a customer and do not want to search or display unique addresses. Without an identifier, the BDC treats the addresses that are returned by the external system as just a blob of data; you cannot run actions on this external content type, use the entity instance picker, relate addresses with another external content type, or search on or crawl for the external data.

Another important concept this external content type demonstrates is BDC support for complex formatting. You can use the complex formatting feature to display the address structure in a formatted manner, such as "Street, BlockNumber, City, State - PostalCode, Country".

To define the Address external content type

  1. Add the XML for the Address external content type after the LobSystemInstances element. This XML defines the external content type’s title and a method to return addresses.

    Note Note

    The GetAddresses method defined here is a "dummy"; it does not exist in the Web service. The only reason for defining this method in the XML is because of a current limitation of the BDC that requires all entities to have a finder method.

      <Entity Namespace="SampleWebService" Version="" 
              EstimatedInstanceCount="10000" Name="WSAddress" 
          <Method IsStatic="false" Name="GetAddresses">
              <Parameter Direction="In" Name="id">
                <TypeDescriptor TypeName="System.String" 
                                DefaultDisplayName="CustomerID" />
              <Parameter Direction="Return" Name="Addresses">
                  TypeName="BCSServiceProxy.CustomerAddress[], http://air-mail/WSOrders2010/service.asmx?wsdl" 
                  IsCollection="true" Name="CustomerAddresses">
                      TypeName="BCSServiceProxy.CustomerAddress, http://air-mail/WSOrders2010/service.asmx?wsdl" 
                        <Property Name="ComplexFormatting" Type="System.String" />
                        <Property Name="FormatString" Type="System.String">
                          {0}, {1}, {2}, {3} - PostalCode, {4}
                          TypeName="BCSServiceProxy.CustomerStreet, http://air-mail/WSOrders2010/service.asmx?wsdl" 
                            <TypeDescriptor TypeName="System.String" 
                                            Name="BlockNumber" />
                            <TypeDescriptor TypeName="System.String" 
                                            Name="Street" />
                        <TypeDescriptor TypeName="System.String" 
                                        Name="City" />
                          TypeName="BCSServiceProxy.States, http://air-mail/WSOrders2010/service.asmx?wsdl" 
                          Name="StateProvince" />
                        <TypeDescriptor TypeName="System.String" 
                                        Name="CountryRegion" />
                        <TypeDescriptor TypeName="System.String" 
                                        Name="PostalCode" />
              <Association Name="GetAddressesForCustomer" 
                           DefaultDisplayName="Customer Addresses Navigate Association">
                <SourceEntity Namespace="SampleWebService" Name="WSCustomer" />
                <DestinationEntity Namespace="SampleWebService" Name="WSAddress" />
  2. Save the XML file.

© 2016 Microsoft