Exemplo de conectividade da solução
É possível definir as ligações e os terminais de entrada e de saída da solução em um arquivo de definição de conectividade (.cdef).
Use o editor de definição de conectividade do Decision Server Insights para desenvolver o arquivo .cdef.
Exemplo de conectividade de entrada
define inbound binding 'vehicleQuote'
por
description "Vehicle quotations",
como utilizar
message format application/xml,
protocol HTTP,
accepting events:
- New quote
- Existing quote.
define inbound HTTP endpoint 'variable1'
por
description "Inbound vehicle quotes from the web",
como utilizar
binding 'vehicleQuote',
url path "/quotes/incoming".
É possível ampliar uma ligação de entrada, para fornecer classificação e transformação para mensagens de entrada que não estão de acordo com o esquema reconhecido. Caso isso seja feito, o Decision Server Insights testa as mensagens de entrada com relação a uma expressão XPath e as transforma, se necessário, com um documento de transformação .xsl, conforme mostrado nos exemplos a seguir.
Mensagem de entrada:
<?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>
Transformação XSL:
<?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>
Esquema de evento:
<?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>
Evento produzido:
<?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>
Exemplo de conectividade de saída
O exemplo a seguir mostra as ligações e os terminais de saída utilizados pelo Decision Server Insights ao serializar e enviar eventos Claim details como mensagens, que são, então, postadas para o servidor http://claims.example.org. A ligação insuranceClaims assegura que esses tipos de eventos sejam serializados em mensagens .xml. O terminal insuranceClaimsOutbound representa o destino.
define outbound binding 'insuranceClaims'
por
description "Outbound insurance claims binding",
como utilizar
message format application/xml,
protocol HTTP,
delivering events:
- Claim details.
define outbound HTTP endpoint 'insuranceClaimsOutbound'
por
description "Outbound insurance claims endpoint",
como utilizar
binding 'insuranceClaims',
url "http://claims.example.org/claims/outbound".