分散トランザクション処理機能 TP1/Connector for .NET Framework 使用の手引

[目次][用語][索引][前へ][次へ]

1.9.7 アプリケーション構成ファイルの設定方法

WCF連携機能でTP1IntegrationBindingを使用する場合のWCFの設定方法について説明します。なお,WCFの設定方法の詳細については,.NET Frameworkのドキュメントを参照してください。また,Connector .NET構成定義の詳細については,「2. 構成定義」を参照してください。

WCF連携機能を使用する場合,呼び出すサービスおよびクライアントの設定を,アプリケーション構成ファイルの<system.serviceModel>要素に記述します。

形式

[図データ]

形式の(1)〜(4)は,次に説明する番号に対応しています。

<この項の構成>
(1) <client>要素に定義する内容
(2) <bindings>要素に定義する内容
(3) <behaviors>要素に定義する内容
(4) <extensions>要素に定義する内容
(5) アプリケーション構成ファイルの設定例

(1) <client>要素に定義する内容

(a) 形式
<client>
  <endpoint name="<endpoint>要素の名称"
            address="呼び出したいOpenTP1のサービスの位置情報"
            binding="tp1IntegrationBinding"
            contract="WCF連携機能で使用するサービスコントラクト"
            behaviorConfiguration="<behavior>要素のname属性の値"
            bindingConfiguration="">
  </endpoint>
</client>
(b) 要素
●endpoint

WCFのクライアント側のendpointを設定する要素です。

この要素は省略できません。

(c) 属性
●name

<endpoint>要素の名称を指定します。

●address

呼び出したいOpenTP1のサービスの位置情報をopentp1.rpc URIの形式で指定します。

opentp1.rcp URIの形式および指定例については,「1.9.5 接続先OepnTP1のサービスの位置情報の指定形式」を参照してください。

この属性は省略できません。

●binding

「tp1IntegrationBinding」を指定します。

この属性は省略できません。また,大文字と小文字が区別されるため注意してください。

●contract

WCF連携機能で使用するサービスコントラクトを完全限定名で指定します。

この属性は省略できません。

●behaviorConfiguration

<tp1Behavior>要素を含む<behavior>要素を指定します。この属性は,<behavior>要素のname属性と同じ値を指定してください。

この属性は省略できません。

●bindingConfiguration

WCF連携機能では使用しません。この属性は省略するか,または空文字を指定してください。

(2) <bindings>要素に定義する内容

(a) 形式
<bindings>
  <tp1IntegrationBinding />
</bindings>
(b) 要素
●tp1IntegrationBinding

tp1IntegrationBindingのBindingについて設定する要素です。tp1IntegrationBindingを設定する場合,「<tp1IntegrationBinding />」と記述します。

この要素は省略できません。

この要素は,属性および子要素を持ちません。

(3) <behaviors>要素に定義する内容

(a) 形式
<behaviors>
  <endpointBehaviors>
    <behavior name="<behavior>要素を一意に識別するための名称">
      <tp1Behavior />
    </behavior>
  </endpointBehaviors>
</behaviors>
(b) 要素
●endpointBehaviors

子要素として,<behavior>要素を定義します。

この要素は省略できません。

●behavior

Bindingの検証を設定する要素です。

この要素は省略できません。

子要素として,<tp1Behavior>要素を定義します。

●tp1Behavior

tp1IntegrationBehaviorについて設定する要素です。tp1Behaviorを設定する場合,「<tp1Behavior />」と記述します。

この要素は省略できません。

この要素は,属性および子要素を持ちません。

(c) 属性
●name

<behavior>要素を一意に識別するための名称を指定します。この属性は,<endpoint>要素のbehaviorConfiguration属性と同じ値を指定してください。

この属性は省略できません。

(4) <extensions>要素に定義する内容

(a) 形式
<extensions>
  <behaviorExtensions>
    <add name="tp1Behavior"
         type="Hitachi.OpenTP1.ServiceModel.TP1Integration.
               TP1IntegrationBehaviorElement,
               Hitachi.OpenTP1.ServiceModel.TP1Integration,
               Version=7.0.0.0, Culture=neutral,
               PublicKeyToken=2440cf5f0d80c91c" />
  </behaviorExtensions>
  <bindingExtensions>
    <add name="tp1IntegrationBinding"
         type="Hitachi.OpenTP1.ServiceModel.TP1Integration.
               TP1IntegrationBindingCollectionElement,
               Hitachi.OpenTP1.ServiceModel.TP1Integration,
               Version=7.0.0.0, Culture=neutral,
               PublicKeyToken=2440cf5f0d80c91c"/>
  </bindingExtensions>
</extensions>
(b) 要素
●extensions

bindingやbehaviorを拡張するための設定をする要素です。

この要素は省略できません。

子要素として,<behaviorExtensions>要素および<bindingExtensions>要素を定義します。

●behaviorExtensions

<tp1Behavior>要素をアプリケーション構成ファイルに定義できるように機能を拡張するための要素です。

この要素は省略できません。

子要素として,<add>要素を次のように定義します。

 
<behaviorExtensions>
  <add name="tp1Behavior"
       type="Hitachi.OpenTP1.ServiceModel.TP1Integration.
             TP1IntegrationBehaviorElement,
             Hitachi.OpenTP1.ServiceModel.TP1Integration,
             Version=7.0.0.0, Culture=neutral,
             PublicKeyToken=2440cf5f0d80c91c" />
</behaviorExtensions>
 
●bindingExtensions

<tp1IntegrationBinding>要素をアプリケーション構成ファイルに定義できるように機能を拡張するための要素です。

この要素は省略できません。

子要素として,<add>要素を次のように定義します。

 
<bindingExtensions>
  <add name="tp1IntegrationBinding"
       type="Hitachi.OpenTP1.ServiceModel.TP1Integration.
             TP1IntegrationBindingCollectionElement,
             Hitachi.OpenTP1.ServiceModel.TP1Integration,
             Version=7.0.0.0, Culture=neutral,
             PublicKeyToken=2440cf5f0d80c91c"/>
</bindingExtensions>
 

(5) アプリケーション構成ファイルの設定例

WCF連携機能でTP1IntegrationBindingを使用する場合のアプリケーション構成ファイルの設定例を次に示します。WCFの設定以外の記述は,Connector .NET構成定義です。Connector .NET構成定義については,「2. 構成定義」を参照してください。

 
<configuration>
  <configSections>
    <section
      name="hitachi.opentp1.connector"
      type="Hitachi.OpenTP1.Common.Util.ProfileSectionHandler,
            Hitachi.OpenTP1.Client,Version=7.0.0.0,
            Culture=neutral,PublicKeyToken=2440cf5f0d80c91c,
            Custom=null"   />
    <section
      name="hitachi.opentp1.client"
      type="Hitachi.OpenTP1.Common.Util.ProfileSectionHandler,
            Hitachi.OpenTP1.Client,Version=7.0.0.0,
            Culture=neutral,PublicKeyToken=2440cf5f0d80c91c,
            Custom=null"   />
  </configSections>
 
  <!-- WCFの設定 -->
 
  <system.serviceModel>
    <client>
      <endpoint
        name="Gyoumu1"
        address="opentp1.rpc://MyProfile1/Gyoumu1"
        binding="tp1IntegrationBinding"
        contract="Hitachi.OpenTP1.ServiceModel
                  .TP1Integration.ITP1Rpc"
        behaviorConfiguration="TP1BehaviorConfig">
      </endpoint>
      <endpoint
        name="Gyoumu2"
        address="opentp1.rpc:///Gyoumu2"
        binding="tp1IntegrationBinding"
        contract="Hitachi.OpenTP1.ServiceModel
                  .TP1Integration.ITP1Rpc"
        behaviorConfiguration="TP1BehaviorConfig">
      </endpoint>
    </client>
 
    <bindings>
      <tp1IntegrationBinding />
    </bindings>
 
    <behaviors>
      <endpointBehaviors>
        <behavior name="TP1BehaviorConfig">
          <tp1Behavior />
        </behavior>
      </endpointBehaviors>
    </behaviors>
 
    <extensions>
      <behaviorExtensions>
        <add
          name="tp1Behavior"
          type="Hitachi.OpenTP1.ServiceModel.TP1Integration
                .TP1IntegrationBehaviorElement,
                Hitachi.OpenTP1.ServiceModel.TP1Integration,
                Version=7.0.0.0, Culture=neutral,
                PublicKeyToken=2440cf5f0d80c91c" />
      </behaviorExtensions>
      <bindingExtensions>
        <add
          name="tp1IntegrationBinding"
          type="Hitachi.OpenTP1.ServiceModel.TP1Integration
                .TP1IntegrationBindingCollectionElement,
                Hitachi.OpenTP1.ServiceModel.TP1Integration,
                Version=7.0.0.0, Culture=neutral,
                PublicKeyToken=2440cf5f0d80c91c"/>
      </bindingExtensions>
    </extensions>
  </system.serviceModel>
 
  <!-- Connector .NETの構成定義-->
  
  <hitachi.opentp1.connector>
    <common>
    <client conf=""/>
      <connection pooled="20" active="100"
                  threshold="80" watchtime="120"
                  failureInfoSharing="true"
                  failureCheckInterval="300">
        <occupation pooled="10"/>
      </connection>
      <log destination="c:\temp\connectorn"
           fileSize="1048576" level="1"/>
      <buffer pooling="true" create="false">
        <largestBufferPool maxCount="5" threshold="100" />
        <bufferPool size="102400" maxCount="50"
                    threshold="120" />
        <bufferPool size="10240" maxCount="50"
                    threshold="150" />
      </buffer>
      <perfCounter use="true" />
      <option maxMessageSize="8" />
    </common>
    <profile id="MyProfile1">
      <client conf="clinetProfile1"/>
      <connection>
        <occupation pooled="2"/>
      </connection>
    </profile>
  </hitachi.opentp1.connector>
 
  <hitachi.opentp1.client>
    <common>
      <tp1Server host="hostA" />
      <rpc use="nam" watchTime="0" />
      <nameService port="10000" />
    </common>
    <profile id="traceMode">
      <errTrace use="true" path="c:\temp\clientn"
                fileSize="100000" />
      <methodTrace use="true" path="c:\temp\clientn"
                   fileSize="100000" />
      <uapTrace use="true" path="c:\temp\clientn"
                fileSize="100000" />
      <dataTrace use="true" path="c:\temp\clientn"
                 fileSize="100000" />
    <profile id="clinetProfile1">
      <tp1Server host="hostA" />
      <rpc use="nam" watchTime="0" />
      <nameService port="10000" />
    </profile>
  </hitachi.opentp1.client>
 
</configuration>