123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cogadmin
- (C) Copyright IBM Corp. 2005, 2019
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:out="dummy-uri"
- exclude-result-prefixes="xsl send xts bus">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <!--
- ===============================================================================================
- send:request - Builds an xts:request that contains a valid BIBus request. The caller can
- ignore the details of the SOAP:Header, and simply supply the contents of
- the bus:request.
- ===============================================================================================
- -->
- <xsl:template match="send:request">
- <xts:request>
- <xsl:choose>
- <xsl:when test="@provider='cm'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://cm</xsl:attribute>
- <xsl:attribute name="soapAction">http://www.ibm.com/xmlns/prod/cognos/contentManagerService/201904/</xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='xts'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://xts</xsl:attribute>
- <xsl:attribute name="soapAction">xts.run</xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='eventManagementService'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction">
- <xsl:text>http://www.ibm.com/xmlns/prod/cognos/eventManagementService/201610/</xsl:text>
- <xsl:if test="@affinity">
- <xsl:value-of select="concat('.', @affinity)"/>
- </xsl:if>
- </xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- </xsl:choose>
- <xsl:copy-of select="@*[name() != 'provider' and name() != 'affinity' and name() != 'directedRequest' and name()!='soapAction']"/>
- <!-- copy any xts:output-param elements -->
- <xsl:copy-of select="*[local-name()='output-param']"/>
- <SOAP-ENV:Envelope>
- <SOAP-ENV:Header>
- <bus:biBusHeader>
- <out:choose>
- <out:when test="/root/header/bus:biBusHeader">
- <out:choose>
- <out:when test="/root/env/param[@name='m_tracking'] and /root/env/param[@name='m_tracking']!='' and ('{@affinity}'='.high' or '{@affinity}'='.absolute')">
- <out:value-of select="xtsext:web64decode( xtsext:cafaction( 'sign_unwrap', string( /root/env/param[@name='m_tracking'] )), true() )" disable-output-escaping="yes"/>
- </out:when>
- <out:otherwise>
- <out:copy-of select="/root/header/bus:biBusHeader/bus:tracking"/>
- </out:otherwise>
- </out:choose>
- <!-- set up the rest of the header elements -->
- <out:for-each select="/root/header/bus:biBusHeader/*">
- <out:choose>
- <out:when test="local-name()='tracking'"/>
- <out:when test="local-name()='hdrSession'">
- <xsl:choose>
- <xsl:when test="starts-with(@provider, 'cm')">
- <!-- trim the bus header before sending to cm -->
- <out:copy>
- <out:copy-of select="@*"/>
- <bus:formFieldVars xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:formFieldVar[]">
- <out:copy-of select="item[starts-with(name, 'CAM')]"/>
- </bus:formFieldVars>
- <out:copy-of select="*[local-name() != 'formFieldVars']"/>
- </out:copy>
- </xsl:when>
- <xsl:otherwise>
- <out:copy>
- <out:copy-of select="@*"/>
- <out:copy-of select="*"/>
- </out:copy>
- </xsl:otherwise>
- </xsl:choose>
- </out:when>
- <out:otherwise>
- <out:copy>
- <out:copy-of select="@*"/>
- <!-- copy child elements except the CAMCredentialPath -->
- <out:copy-of select="*[local-name() != 'CAMCredentialPath']"/>
- </out:copy>
- </out:otherwise>
- </out:choose>
- </out:for-each>
- </out:when>
- <out:otherwise>
- <!-- there's no header - this means we've come in through transerv. Build one from scratch -->
- <bus:userPreferenceVars xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:userPreferenceVar[]">
- <item>
- <name xsi:type="xsd:string">timeZoneID</name>
- <value xsi:type="xsd:string">America/New_York</value>
- </item>
- <item>
- <name xsi:type="xsd:string">productLocale</name>
- <value xsi:type="xsd:string"><out:value-of select="substring(/root/http/param[@name='HTTP_ACCEPT_LANGUAGE'],1,2)"/></value>
- </item>
- <item>
- <name xsi:type="xsd:string">contentLocale</name>
- <value xsi:type="xsd:string"><out:value-of select="substring(/root/http/param[@name='HTTP_ACCEPT_LANGUAGE'],1,2)"/></value>
- </item>
- <item>
- <name xsi:type="xsd:string">format</name>
- <value xsi:type="xsd:string">HTML</value>
- </item>
- </bus:userPreferenceVars>
- <bus:CAM xsi:type="bus:CAM">
- <CAMPassport xsi:type="bus:CAMPassport">
- <id xsi:type="xsd:string">
- <out:choose>
- <out:when test="/root/cookies/cookie[@name='cam_passport']">
- <out:value-of select="/root/cookies/cookie[@name='cam_passport']"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="/root/env/param[@name='cam_passport']"/>
- </out:otherwise>
- </out:choose>
- </id>
- </CAMPassport>
- </bus:CAM>
- </out:otherwise>
- </out:choose>
- </bus:biBusHeader>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <xsl:apply-templates/>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xts:request>
- </xsl:template>
-
- <xsl:template match="*[local-name()='output-param']"/>
-
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
-
- </xsl:stylesheet>
|