ソリューション接続の例
接続定義 (.cdef) ファイルに、ソリューションのインバウンド・バインディングとアウトバウンド・バインディング、およびエンドポイントを定義することができます。
Decision Server Insights 接続定義エディターを使用して、.cdef ファイルを作成します。
インバウンド接続の例
以下の例は、Decision Server
Insights がインバウンド・メッセージを処理する時に使用するバインディングとエンドポイントを示しています。http://quotesystem.company.com サーバーは、HTTP メッセージを Decision Server
Insights に送ります。メッセージは処理されて、New quote イベントまたは Existing quote イベントが生成されます。vehicleQuote インバウンド・バインディングは、インバウンド・メッセージの受け入れられるフォーマットおよびプロトコルとして、.xml と HTTP を定義しています。variable1 エンドポイントは、メッセージの発信元を表します。
define inbound binding 'vehicleQuote'
with
description "Vehicle quotations",
using
message format application/xml,
protocol HTTP,
accepting events:
- New quote
- Existing quote.
define inbound HTTP endpoint 'variable1'
with
description "Inbound vehicle quotes from the web",
using
binding 'vehicleQuote',
url path "/quotes/incoming".
インバウンド・バインディングを拡張して、認識されるスキーマに準拠していないインバウンド・メッセージのメッセージ種別と変換を提供することができます。これを行うと、Decision Server Insights は、XPath 式を使用してインバウンド・メッセージをテストし、必要な場合、以下の例に示されている .xsl 変換文書を使用してそれらを変換します。
インバウンド・メッセージ:
<?xml version="1.0"?>
<event type="movement">
<flight>SE36/XLF036</flight>
<registration>F-GRSQ</registration>
<altitudeFeet>36000</altitudeFeet>
<course>253</course>
<speedKnots>466</speedKnots>
<longitude>2.56119</longitude>
<latitude>49.0016</latitude>
</event>
XSL Transformation:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.example.org/FlightMovement"
xmlns:context="com.ibm.ia.connectivity.context.MessageContextProvider">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="event">
<FlightMovement>
<flight>
<xsl:value-of select="flight" />
</flight>
<registration>
<xsl:value-of select="registration" />
</registration>
<position>
<latitude>
<xsl:value-of select="latitude" />
</latitude>
<longitude>
<xsl:value-of select="longitude" />
</longitude>
<speedKnots>
<xsl:value-of select="speedKnots" />
</speedKnots>
<altitudeFeet>
<xsl:value-of select="altitudeFeet" />
</altitudeFeet>
<course>
<xsl:value-of select="course" />
</course>
</position>
</FlightMovement>
</xsl:template>
</xsl:stylesheet>
イベント・スキーマ:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/FlightMovement" xmlns:tns="http://www.example.org/FlightMovement" elementFormDefault="qualified">
<complexType name="FlightMovement">
<sequence>
<element name="flight" type="string"></element>
<element name="registration" type="string"></element>
<element name="position" type="tns:Position"></element>
</sequence>
</complexType>
<complexType name="Position">
<sequence>
<element name="latitude" type="double"></element>
<element name="longitude" type="double"></element>
<element name="speedKnots" type="double"></element>
<element name="altitudeFeet" type="int"></element>
<element name="course" type="int"></element>
</sequence>
</complexType>
</schema>
生成されるイベント:
<?xml version="1.0" encoding="UTF-8"?>
<FlightMovement xmlns="http://www.example.org/FlightMovement">
<flight>SE36/XLF036</flight>
<registration>F-GRSQ</registration>
<position>
<latitude>49.0016</latitude>
<longitude>2.56119</longitude>
<speedKnots>466</speedKnots>
<altitudeFeet>36000</altitudeFeet>
<course>253</course>
</position>
</FlightMovement>
アウトバウンド接続の例
以下の例は、Decision Server Insights が、Claim details イベントをメッセージとしてシリアライズし、送信する時に使用するアウトバウンド・バインディングとアウトバウンド・エンドポイントを示しています。その後、それらのメッセージは http://claims.example.org サーバーに送られます。insuranceClaims バインディングは、それらのイベント・タイプが確実に .xml メッセージにシリアライズされるようにします。insuranceClaimsOutbound エンドポイントは宛先を表します。
define outbound binding 'insuranceClaims'
with
description "Outbound insurance claims binding",
using
message format application/xml,
protocol HTTP,
delivering events:
- Claim details.
define outbound HTTP endpoint 'insuranceClaimsOutbound'
with
description "Outbound insurance claims endpoint",
using
binding 'insuranceClaims',
url "http://claims.example.org/claims/outbound".