为 Oracle 电子商务套件配置客户端绑定

生成 WCF 客户端类后,可以) 创建 WCF 客户端 (实例,并调用其方法来使用 Oracle E-Business 适配器。

若要创建 WCF 客户端,必须指定终结点地址和绑定。 终结点地址必须包含有效的 Oracle E-Business Suite 连接 URI,并且绑定必须是 Oracle E-Business Suite 绑定 (OracleEBSBinding) 的实例。 有关 Oracle E-Business Suite 连接 URI 的详细信息,请参阅 创建与 Oracle 电子商务套件的连接。 建议不要将用户凭据指定为连接 URI 的一部分。 可以改用 WCF 客户端的 ClientCredentials 属性,如本主题中所述。

可以在代码或配置文件中指定 Oracle E-Business Suite 绑定和终结点地址。 使用添加适配器服务参考 Visual Studio 插件生成 WCF 客户端类时,还会为项目创建配置文件 (app.config) 。 此文件包含的配置设置反映绑定属性和连接信息 (凭据) 除外,你在使用添加适配器服务引用插件连接到 Oracle 电子商务套件时指定的凭据。

在代码中指定绑定和终结点地址

以下代码演示如何通过使用 WCF 客户端的 ClientCredentials 属性在代码中指定绑定和终结点地址来创建 WCF 客户端。

//Create an Oracle EBS binding and set the binding properties  
OracleEBSBinding binding = new OracleEBSBinding();  
binding.OracleUserName = "myOracleEBSUser";  
binding.OraclePassword = "myOracleEBSPassword";  
binding.OracleEBSResponsibilityName = "Responsibility";  
binding.OracleEBSOrganizationId = "204";  
  
//Create the client endpoint   
EndpointAddress address = new EndpointAddress("oracleebs://<oracleebs_instance_name>/");  
  
//Create the client and specify the credentials  
ConcurrentPrograms_ARClient client = new ConcurrentPrograms_ARClient(binding,address);  
client.ClientCredentials.UserName.UserName = "myuser";  
client.ClientCredentials.UserName.Password = "mypassword";  
  
//Open the client  
client.Open();  

在配置文件中指定绑定和终结点地址

以下代码演示如何通过在 app.config 文件中指定绑定和终结点地址来创建 WCF 客户端。

//Create the client by specifying the endpoint name in the app.config. In this case, the binding properties  
//must also be specified in the app.config.  
ConcurrentPrograms_ARClient client = new ConcurrentPrograms_ARClient("OracleEBSBinding_ConcurrentPrograms_AR");  
  
//Specify the credentials   
client.ClientCredentials.UserName.UserName = "myuser";  
client.ClientCredentials.UserName.Password = "mypassword";  
  
client.Open();  

以下 XML 显示由添加适配器服务引用插件为 Customer Interface 并发程序创建的配置文件。 此文件包含前面示例中引用的客户端终结点配置。

<?xml version="1.0" encoding="utf-8"?>  
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">  
    <system.serviceModel>  
        <bindings>  
            <oracleEBSBinding>  
                <binding openTimeout="00:05:00" name="OracleEBSBinding" closeTimeout="00:01:00"  
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" clientCredentialType="Database"  
                    inboundOperationType="Polling" metadataPooling="true" statementCachePurge="false"  
                    statementCacheSize="10" pollWhileDataFound="false" pollingInterval="30"  
                    useOracleConnectionPool="true" minPoolSize="1" maxPoolSize="100"  
                    incrPoolSize="5" decrPoolSize="1" connectionLifetime="0" acceptCredentialsInUri="false"  
                    useAmbientTransaction="true" notifyOnListenerStart="true"  
                    notificationPort="-1" dataFetchSize="65536" longDatatypeColumnSize="32512"  
                    skipNilNodes="true" maxOutputAssociativeArrayElements="32"  
                    enableSafeTyping="false" insertBatchSize="20" useSchemaInNameSpace="true"  
                    enableBizTalkCompatibilityMode="true">  
                    <mlsSettings language="" dateFormat="" dateLanguage="" numericCharacters=""  
                        sort="" territory="" comparison="" currency="" dualCurrency=""  
                        iSOCurrency="" calendar="" lengthSemantics="" nCharConversionException="true"  
                        timeStampFormat="" timeStampTZFormat="" timeZone="" />  
                </binding>  
            </oracleEBSBinding>  
        </bindings>  
        <client>  
            <endpoint address="oracleebs://ebs-70-12/" binding="oracleEBSBinding"  
                bindingConfiguration="OracleEBSBinding" contract="ConcurrentPrograms_AR"  
                name="OracleEBSBinding_ConcurrentPrograms_AR" />  
        </client>  
    </system.serviceModel>  
</configuration>  

如果项目有多个 WCF 客户端,配置文件中将定义多个客户端终结点条目。 每个 WCF 客户端条目将根据其绑定配置和目标 Oracle 电子商务套件项目具有唯一的名称。 如果多次连接以在项目中创建 WCF 客户端,则会创建多个绑定配置条目,每个连接一个绑定配置条目。 这些绑定配置条目将按以下方式命名:OracleEBSBinding、OracleEBSBinding1 等。 在特定连接期间创建的每个客户端终结点条目都将引用在该连接期间创建的绑定项。

另请参阅

使用 WCF 服务模型开发 Oracle E-Business Suite 应用程序