Common Errors in BDC with Web Services

As a SharePoint developer, I feel one of the highlights of MOSS has been – BDC (Business Data Catalog). It allows you to connect to a variety of data sources – Databases – SQL server, Oracle, SyBase, etc. and Web Services. The good thing about BDC usage is its ease to create and connect to variety of data sources.

Since the inception of MOSS, the online articles on BDC issues have improved considerably – but only for the BDC with Databases. Sorry to say that but I found little help on BDC with web services issues. Just recently, I had to work with functionality on BDC with web services and for basic errors also I was not able to get any help. So I thought, let me do my bit for the SharePoint community. (Yah, I know that’s nice of me.J)

So let’s go straightaway into some error messages:-

1. When you tried importing, the App. Def. File into the BDC Catalog Editor it gave you the error:-

"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name:index".

Reason: This error comes if in your Application Definition File you have a data table in your type descriptor and you have not elaborated on the structure of the data table. What I mean is if you have a type descriptor as below:-

<TypeDescriptor TypeName="System.Data.DataTable, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Return" />

Whereas it should be elaborated to:-

<TypeDescriptor TypeName="System.Data.DataTable, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Return" >

                          <TypeDescriptors>

                                                      <TypeDescriptor TypeName="System.Data.DataRowCollection, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="Rows" IsCollection="true" >

                                                            <TypeDescriptors>

                                                                  <TypeDescriptor TypeName="System.Data.DataRow, System.Data, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Name="DataRow">

                                                                  <TypeDescriptors>

                                                                        <TypeDescriptor TypeName="System.String" Name="lastname" />

                                                                        <TypeDescriptor TypeName="System.String" Name="firstname" />

                                                                        <TypeDescriptor TypeName="System.String" Name="middlename" />

                                                                  </TypeDescriptors>

                                                                  </TypeDescriptor>

                                                            </TypeDescriptors>

                                                      </TypeDescriptor>

                        </TypeDescriptors>

</TypeDescriptor>

      Please also ensure that your method instances defined have the - “ReturnTypeDescriptorName” =Rows & “ReturnTypeDescriptorLevel=1 as shown below:-

<MethodInstances>

            <MethodInstance Type="SpecificFinder" ReturnParameterName="Return" ReturnTypeDescriptorName="Rows" ReturnTypeDescriptorLevel="1" Name="GetContactInstance" />

      </MethodInstances>

 

2. After importing an Application Definition File to SharePoint , you get this error:

“Could not create profile page for Entity FilteredContact. The error is: Profile page creation for the Entity FilteredContact skipped. Entity FilteredContact has no identifiers defined in the SpecificFinder view.”

Reason: The error comes when the type descriptor of the return type doesn’t specify the identifier name. Correct this by adding the identifier name.

<TypeDescriptors>

         <TypeDescriptor TypeName="System.String" IdentifierName="ADAccount" Name="lastname" />

         <TypeDescriptor TypeName="System.String" Name="firstname" />

         <TypeDescriptor TypeName="System.String" Name="middlename" />

         <TypeDescriptor TypeName="System.String" Name="new_csuid" />

         <TypeDescriptor TypeName="System.String" Name="telephone1" />

         <TypeDescriptor TypeName="System.String" Name="department" />

         <TypeDescriptor TypeName="System.String" Name="new_officenumber" />

         <TypeDescriptor TypeName="System.String" Name="jobtitle" />

         <TypeDescriptor TypeName="System.String" Name="emailaddress1" />

         <TypeDescriptor TypeName="System.String" Name="new_organization" />

</TypeDescriptors>