httprest
.<Event>
<b1e:b1events>
<b1e:b1event>
<b1e:eventsource>XXXXXXXXXX</b1e:eventsource>
<b1e:objecttype>17</b1e:objecttype>
<b1e:transactiontype>U</b1e:transactiontype>
<b1e:usercode>manager</b1e:usercode>
<b1e:userid>manager</b1e:userid>
<b1e:keys count="1">
<b1e:key>
<b1e:name>DocEntry</b1e:name>
<b1e:value>4711</b1e:value>
</b1e:key>
</b1e:keys>
</b1e:b1event>
</b1e:b1events>
</Event>
xsl
template file which can be seen below. It retrieves the previously fetched OAuth token and populates it into a variable to be used in the HTTP call. The message body itself is transformed into a JSON array of events published by the B1 system with the relevant details from each of the events.<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:b1e="urn:com.sap.b1i.sim:b1event" xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:exslt="http://exslt.org/common" xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:js="com.sap.b1i.bpc_tools.Javascript" xmlns:rev="urn:com.sap.b1i.adapter:revaadapter" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:utils="com.sap.b1i.bpc_tools.Utilities" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" xmlns:xca="urn:com.sap.b1i.xcellerator:appconfig" xmlns:xci="urn:com.sap.b1i.xcellerator:intdoc" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="b1e b1ie b1im bfa jdbc js rfc utils xci xca vpf exslt sim rev" b1e:force="" b1ie:force="" b1im:force="" bfa:force="" jdbc:force="" js:force="" rfc:force="" utils:force="" xci:force="" xca:force="" vpf:force="" exslt:force="" sim:force="" rev:force="">
<?prodver 1.0.0?>
<xsl:include href="../../com.sap.b1i.dev.repository/IDE/init.xsl"></xsl:include>
<xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']"></xsl:variable>
<xsl:template match="/">
<vpf:Msg>
<xsl:copy-of select="/vpf:Msg/@*"></xsl:copy-of>
<xsl:copy-of select="/vpf:Msg/vpf:Header"></xsl:copy-of>
<vpf:Body>
<xsl:copy-of select="/vpf:Msg/vpf:Body/*"></xsl:copy-of>
<vpf:Payload Role="X" id="{$atom}">
<xsl:call-template name="transform"></xsl:call-template>
</vpf:Payload>
</vpf:Body>
</vpf:Msg>
</xsl:template>
<xsl:template name="transform">
<xsl:variable name="token">
<xsl:value-of select="document('/MyTokens/TokenIntegrationSuite/CPIToken.xml')//bfa:string[@name='access_token']"></xsl:value-of>
</xsl:variable>
<ReadToken>
<xsl:value-of select="concat('Bearer', ' ', $token)"></xsl:value-of>
</ReadToken>
<io xmlns="urn:com.sap.b1i.bizprocessor:bizatoms" pltype="json">
<array name="b1events">
<xsl:for-each select="/Event/b1e:b1events/b1e:b1event">
<object>
<string name="EventSource">
<xsl:value-of select="./b1e:eventsource"></xsl:value-of>
</string>
<string name="ObjectType">
<xsl:value-of select="./b1e:objecttype"></xsl:value-of>
</string>
<string name="TransactionType">
<xsl:value-of select="./b1e:transactiontype"></xsl:value-of>
</string>
<string name="UserCode">
<xsl:value-of select="./b1e:usercode"></xsl:value-of>
</string>
<string name="UserId">
<xsl:value-of select="./b1e:userid"></xsl:value-of>
</string>
<array name="keys">
<xsl:for-each select="./b1e:keys/b1e:key">
<object>
<string name="Name">
<xsl:value-of select="./b1e:name"></xsl:value-of>
</string>
<string name="Value">
<xsl:value-of select="./b1e:value"></xsl:value-of>
</string>
</object>
</xsl:for-each>
</array>
</object>
</xsl:for-each>
</array>
</io>
</xsl:template>
</xsl:stylesheet>
Authorization
: Contains the OAuth tokenx-qos
: Quality of service desired for this messagecontent-type
: Content type to ensure correct processing in the consuming applicationpltype
configuration is set as json
to ensure the correct output format. In the destination path configuration the queue name is populated to identify the queue the message is meant for. The queue name should be URl encoded as stated in the SAP Event Mesh API documentation. The value of the Authorization
header is populated through the following XPath expression accessing the attribute holding the token in the message:/vpf:Msg/vpf:Body/vpf:Payload[./@id='PrepareMessage4CPI']/ReadToken
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
23 | |
9 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 |