使用 Siebel 适配器和 SharePoint 时的注意事项

本主题包含有关在将 Microsoft BizTalk Adapter for Siebel eBusiness Applications 与 Microsoft Office SharePoint Server 配合使用时可能遇到的问题的信息,以及解决方法。 此问题分为两个类别:

  • 常规问题

  • 涉及自定义 Web 部件的问题

一般问题

本部分包含的问题要么没有解决方法,要么需要修改应用程序定义文件才能解决问题。

问题 1:不显示 WCF 服务返回的简单类型数据

说明:Microsoft Office SharePoint Server 要求 WCF 服务返回的数据仅为 DataSet 或集合类型。 如果 WCF 服务返回的数据为简单类型,则 Microsoft Office SharePoint Server 不会显示数据。

解决方法:无解决方法。 这是 Microsoft Office SharePoint Server 的已知限制。

问题 2:如果 WCF 服务返回的数据为 NULL,则显示错误消息

说明:如果 WCF 服务返回的数据为 NULL 值,Microsoft Office SharePoint Server 将显示错误消息。 例如,假设您将业务数据列表 Web 部件用于 Finder 方法实例,并且基于搜索表达式在 Siebel 系统中搜索客户。 指定的搜索表达式提取 NULL 值。 在这种情况下,Microsoft Office SharePoint Server 将显示错误消息。

解决方法:无解决方法。 这是 Microsoft Office SharePoint Server 的已知限制。

问题 3:不显示 WCF 服务返回的简单类型的数组

说明:如果 WCF 服务返回的数据是简单类型的数组,则 Microsoft Office SharePoint Server 不显示数据。 此外,在业务数据目录定义编辑器中执行返回简单类型的数组的方法实例时,将显示以下错误消息:“后端系统适配器返回的结构与相应元数据不兼容, (MethodInstance、Parameter 或 TypeDescriptor) ”。

解决方法:无解决方法。 这是 Microsoft Office SharePoint Server 和企业数据目录定义编辑器的已知限制。

问题 4:无法导入包含具有 300 多个字段的复杂类型参数的应用程序定义文件

说明:Microsoft Office SharePoint Server 无法导入 WCF 服务返回的复杂类型参数中包含超过 300 个字段的应用程序定义文件,如果尝试导入,则会显示错误消息。 这是因为 Microsoft Office SharePoint Server 无法显示超过 300 个复杂类型参数的字段。

解决方法:使用业务数据目录定义编辑器将复杂类型参数的字段数限制为小于或等于 300。 根据你的要求,你可以在商业数据目录定义编辑器中删除复杂类型参数的字段,这些字段不需要显示在 Microsoft Office SharePoint Server 中。 或者,还可以从包含所有字段的 Business 数据目录 定义编辑器中导出应用程序定义文件,然后在记事本或任何 XML 创作应用程序中修改应用程序定义文件,以删除不需要的字段,以便将字段数限制为 300。

涉及自定义 Web 部件的问题

本节包含需要使用自定义 Web 部件解决问题的问题。 有关使用自定义 Web 部件解决使用 Siebel 适配器和 Microsoft Office SharePoint Server 时可能出现的问题的详细信息,请参阅 将自定义 Web 部件与 Siebel 适配器配合使用

问题 1:显示枚举器的索引,而不是枚举数据类型的值

说明:如果 Microsoft Office SharePoint Server 中的业务数据列表或业务数据项 Web 部件包含枚举类型的数据 (由一组名为枚举器) 的命名常量组成的非重复类型数据,则枚举器的索引将显示在 Microsoft Office SharePoint Server 中,而不是其值。 这是因为业务数据列表和业务数据项 Web 部件错误地将枚举类型数据的值打印到 SharePoint 门户。

解决方法:使用自定义 Web 部件打印枚举器的值,而不是索引。 有关使用自定义 Web 部件的信息,请参阅 将自定义 Web 部件与 Siebel 适配器配合使用。 例如,可以在 Web 部件中使用以下代码示例在 Microsoft Office SharePoint Server 上打印枚举类型数据的正确值。

namespace CustomWebpart  
{  
    public class CustomWebPart : WebPart  
    {  
        private string displayText = "Hello World!";  
  
        [WebBrowsable(true), Personalizable(true)]  
        public string DisplayText  
        {  
            get { return displayText; }  
            set { displayText = value; }  
        }  
        protected override void Render(System.Web.UI.HtmlTextWriter writer)  
        {  
            string SearchExpr = "[Address Name] LIKE \"*\"";  
            object ElementType = null;  
  
/***Step 1: Get the required entity and method.***/  
  
            LobSystem newSystem = ApplicationRegistry.GetLobSystems()["WebServiceLobSystem"]; // Name specified in application definition file  
            LobSystemInstance newSystemInstance = newSystem.GetLobSystemInstances()["Siebel_Instance"]; // Name specified in application definition file  
            Entity CategoryEntity = newSystem.GetEntities()["Siebel_Method_Name"]; // Name specified in application definition file  
            Method newMethod = CategoryEntity.GetMethods()["Query"]; // Name specified in application definition file  
            MethodInstance methodInstance = newMethod.GetMethodInstances()["MethodInstance0"]; // Name specified in application definition file  
  
/***Step 2: Get the list of input parameters.***/  
            Object[] args = methodInstance.GetMethod().CreateDefaultParameterInstances(methodInstance); // Get default value of the input parameter  
            Object[] ArgsInput = new Object[args.Length];  
  
/***Step 3: Assign them required values.***/  
  
           //Assigning values to a complex type parameter. Index of this parameter is 3rd in args array.   
           /*** Complex Type Parameter is defined as follows:  
           <Parameter Direction="In" Name="BusinessAddressQueryInputRecord">  
           <TypeDescriptor TypeName="BDC.BusinessAddressQueryInputRecord,WebServiceLobSystem" Name="BusinessAddressQueryInputRecord">  
              <TypeDescriptors>  
                 <TypeDescriptor TypeName="System.String, ...." Name="SearchExpr"></TypeDescriptor>  
                 <TypeDescriptor TypeName="System.String, ...." Name="SortSpec"></TypeDescriptor>  
                 <TypeDescriptor TypeName="System.String[], ...." IsCollection="true" Name="QueryFields"></TypeDescriptor>  
              </TypeDescriptors>  
           </TypeDescriptor>  
           </Parameter>  
            * We are assigning value to Parameter SearchExpr. ***/  
  
            Assembly asm = Assembly.GetAssembly(args[2].GetType());  
            Type t = asm.GetType(args[2].GetType().ToString()); // Get type of the parameter  
  
            FieldInfo[] FI = t.GetFields();  
            ElementType = Activator.CreateInstance(t);  
            ElementType.GetType().GetFields()[0].SetValue(ElementType, (Object)SearchExpr);  
  
            ArgsInput[2] = ElementType; // ArgsInput is fed as input while executing Method Instance.  
  
/***Step 4: Execute the particular method instance using the required value.***/              
  
            IEntityInstanceEnumerator prodEntityInstanceEnumerator = (IEntityInstanceEnumerator)CategoryEntity.Execute(methodInstance, newSystemInstance, ref ArgsInput); //Method instance of type Finder is being used here.  
  
/***Step 5: Display the output on the custom Web Part in Microsoft Office SharePoint Server.***/  
  
            writer.Write("<table>");  
            while (prodEntityInstanceEnumerator.MoveNext())  
            {  
                IEntityInstance IE = prodEntityInstanceEnumerator.Current;  
  
                writer.Write("<tr>");  
                foreach (Field f in CategoryEntity.GetFinderView().Fields)  
                {  
  
                    writer.Write("<td>");  
                    writer.Write(IE[f]);  
                    writer.Write("</td>");  
                }  
                writer.Write("</tr>");  
            }  
            writer.Write("</table>");  
  
        }  
    }  
}  
  

问题 2:无法指定数组元素的值

说明:如果 WCF 服务的输入参数是数组,则不能使用使用业务数据目录定义编辑器创建的应用程序定义文件中定义的筛选器来指定数组元素的值。 这意味着不能使用 Microsoft Office SharePoint Server 中的业务数据列表或业务数据项 Web 部件来指定这些输入参数的值, (wcf 服务的数组) 元素。 这是因为在应用程序定义文件中定义数组的方式。

解决方法:使用自定义 Web 部件将值分配给数组元素。 有关使用自定义 Web 部件的信息,请参阅 将自定义 Web 部件与 Siebel 适配器配合使用。 例如,可以使用“问题 1:显示枚举器的索引而不是枚举数据类型的值”中的步骤 3 中的以下代码示例将值分配给数组元素。

/***Assign required values to parameters of type array.***/   
/***Assumption is that the ith parameter of Method is of type Array and all the simple type elements in the array are of type string***/  
  
            Type t = asm.GetType(args[i].GetType().ToString()); // Get type of the parameter  
            Type TElement = t.GetElementType(); // Getting type of element of array  
            int index = 5; //Size of Array  
            Array ElementArray = Array.CreateInstance(TElement, index); //Creating an array of length: index  
  
            for (int ind = 0; ind < index; ind++)  
            {  
                //Creating an instance of an element of array  
                object ElementType = Activator.CreateInstance(TElement);  
                FieldInfo[] FI = ElementType.GetType().GetFields();  
                for (int f = 0; f \< FI.Length; f++)  
                {  
                    ElementType.GetType().GetFields()[f].SetValue(ElementType, (Object)"ElementValue");  
                }  
                ElementArray.SetValue(ElementType, ind);  
            }  
  
            ArgsInput[i] = (object)ElementArray; // As shown in sample, ArgsInput is fed as input while executing Method Instance  
  

问题 3:对复杂类型参数指定 NULL 值的限制

说明:如果未为 Microsoft Office SharePoint Server 中的 Web 部件中的复杂类型参数指定任何值,则应将 NULL 作为复杂类型参数的值传递给 WCF 服务。 但是,为复杂类型参数传递非 NULL 值,为其子元素传递 NULL, (简单类型) 。 这会导致预期的消息架构与传递给 WCF 服务的消息架构不匹配。 因此,Siebel 适配器可能会显示错误消息。

注意

若要在 Microsoft Office SharePoint Server 中未从 Web 部件传递任何值时找出复杂类型参数的默认值,请使用“问题 1:显示枚举器的索引而不是枚举数据类型的值”中所述的代码示例中的步骤 2。

解决方法:如果未从 Microsoft Office SharePoint Server 中的 Web 部件指定任何值,则使用自定义 Web 部件将 NULL 值分配给复杂类型参数。 有关使用自定义 Web 部件的信息,请参阅 将自定义 Web 部件与 Siebel 适配器配合使用

问题 4:基于多个值在 Microsoft Office SharePoint Server 中显示单个记录的限制

说明:如果希望基于从 Siebel 系统) (输入参数的多个值在 Microsoft Office SharePoint Server 中显示单个记录,则不能使用第 3 步:创建 SharePoint 应用程序以在教程 1 中从 Siebel 检索数据的三个 Web 部件 (业务数据列表、业务数据项和业务数据相关列表) 指定的任意一个 : 在 SharePoint 网站上呈现来自 Siebel 系统的数据

解决方法:必须使用自定义 Web 部件执行此操作。 有关使用自定义 Web 部件的信息,请参阅 将自定义 Web 部件与 Siebel 适配器配合使用。 例如,在“问题 1:显示枚举器的索引而不是枚举数据类型的值”的步骤 3 中,可以修改代码,为多个参数提供值,而不是为单个业务组件参数提供输入。

另请参阅

使用 Siebel 适配器和 SharePoint