123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2021
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <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:reqhelpers="http://developer.cognos.com/schemas/xts-cm/1/reqhelpers"
- 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:xs="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 reqhelpers 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:variable name="soapaction-map">
- <entry name="$cm$">http://www.ibm.com/xmlns/prod/cognos/contentManagerService/202004/</entry>
- <entry name="$REPOSITORY$">http://www.ibm.com/xmlns/prod/cognos/contentManagerService/202004/</entry>
- <entry name="$cm2$">http://www.ibm.com/xmlns/prod/cognos/contentManagerService/202004/</entry>
- <entry name="$warp$">http://www.ibm.com/xmlns/prod/cognos/reportService/202004/</entry>
- <entry name="$xts$">xts.run</entry>
- <entry name="$dispatcher$">http://www.ibm.com/xmlns/prod/cognos/dispatcherService/202004/</entry>
- <entry name="$monitorService$">http://www.ibm.com/xmlns/prod/cognos/monitorService/202004/</entry>
- <entry name="$eventManagementService$">http://www.ibm.com/xmlns/prod/cognos/eventManagementService/202004/</entry>
- <entry name="$agentService$">http://www.ibm.com/xmlns/prod/cognos/agentService/202004/</entry>
- <entry name="$deliveryService$">http://www.ibm.com/xmlns/prod/cognos/deliveryService/202004/</entry>
- <entry name="$metadataService$">http://www.ibm.com/xmlns/prod/cognos/metadataService/202004/</entry>
- <entry name="$queryService$">http://www.ibm.com/xmlns/prod/cognos/queryService/202004/</entry>
- <entry name="$cmCache$">http://www.ibm.com/xmlns/prod/cognos/contentManagerCacheService/202004/</entry>
- <entry name="$indexDataService$">http://www.ibm.com/xmlns/prod/cognos/indexDataService/202004/</entry>
- <entry name="$cam$">http://www.ibm.com/xmlns/prod/cognos/sacamsrvc-auth/202004/</entry>
- <entry name="$cam-internal$">http://www.ibm.com/xmlns/prod/cognos/sacamsrvc-internal/202004/</entry>
- </xsl:variable>
- <xsl:template match="send:request">
- <xts:request>
- <xsl:choose>
- <xsl:when test="@provider='cam'">
- <xsl:variable name="key">
- <xsl:choose>
- <xsl:when test="@internal='true'">$cam-internal$</xsl:when>
- <xsl:otherwise>$cam$</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction"><xsl:value-of select="$soapaction-map/entry[@name=$key]"/></xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='cm'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://cm</xsl:attribute>
- <xsl:attribute name="soapAction"><xsl:value-of select="$soapaction-map/entry[@name='$cm$']"/></xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='REPOSITORY'">
- <xsl:attribute name="protocol">REPOSITORY</xsl:attribute>
- <xsl:attribute name="href">bus://cm</xsl:attribute>
- <xsl:attribute name="soapAction"><xsl:value-of select="$soapaction-map/entry[@name='$REPOSITORY$']"/></xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- <xsl:attribute name="command"><xsl:value-of select="@command"/></xsl:attribute>
- <xsl:attribute name="returnType"><xsl:value-of select="@returnType"/></xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='cm2'">
- <xsl:attribute name="protocol">CM</xsl:attribute>
- <xsl:attribute name="href">cm://cm</xsl:attribute>
- <xsl:attribute name="soapAction"><xsl:value-of select="$soapaction-map/entry[@name='$cm2$']"/></xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='warp'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction">
- <xsl:choose>
- <xsl:when test="@soapAction and @soapAction!=''"><xsl:value-of select="@soapAction"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="$soapaction-map/entry[@name='$warp$']"/></xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="@affinity"/>
- </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"><xsl:value-of select="$soapaction-map/entry[@name='$xts$']"/></xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='nav'">
- <xsl:attribute name="protocol">NAV</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="outputHeader">false</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='dispatcher'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction"><xsl:value-of select="$soapaction-map/entry[@name='$dispatcher$']"/></xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='monitorService'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction">
- <xsl:value-of select="$soapaction-map/entry[@name='$monitorService$']"/>
- <xsl:if test="@affinity">
- <xsl:value-of select="concat('.', @affinity)"/>
- </xsl:if>
- </xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- <xsl:attribute name="responseEnvelope">
- <xsl:choose>
- <xsl:when test="@responseEnvelope='true'">true</xsl:when>
- <xsl:otherwise>false</xsl:otherwise>
- </xsl:choose>
- </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:value-of select="$soapaction-map/entry[@name='$eventManagementService$']"/>
- <xsl:if test="@affinity">
- <xsl:value-of select="concat('.', @affinity)"/>
- </xsl:if>
- </xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='agentService'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction"><xsl:value-of select="$soapaction-map/entry[@name='$agentService$']"/></xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='deliveryService'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction"><xsl:value-of select="$soapaction-map/entry[@name='$deliveryService$']"/></xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='metadataService'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction">
- <xsl:value-of select="$soapaction-map/entry[@name='$metadataService$']"/>
- <xsl:value-of select="@affinity"/>
- </xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='queryService'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction">
- <xsl:value-of select="$soapaction-map/entry[@name='$queryService$']"/>
- <xsl:value-of select="@affinity"/>
- </xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='cmCache'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction"><xsl:value-of select="$soapaction-map/entry[@name='$cmCache$']"/></xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- <xsl:attribute name="responseEnvelope">false</xsl:attribute>
- </xsl:when>
- </xsl:choose>
- <xsl:copy-of select="@*[name() != 'provider' and name() != 'affinity' and name() != 'directedRequest' and name()!='soapAction']"/>
- <!-- add pre/post-transformation stylesheet for cm2 -->
- <xsl:if test="@provider='cm2'">
- <xsl:if test="@prexslt">
- <xts:param name="prexslt"><xsl:value-of select="@prexslt"/></xts:param>
- </xsl:if>
- <xsl:if test="@postxslt">
- <xts:param name="postxslt"><xsl:value-of select="@postxslt"/></xts:param>
- </xsl:if>
- </xsl:if>
- <!-- copy any xts:output-param elements -->
- <xsl:copy-of select="*[local-name()='output-param']"/>
- <SOAP-ENV:Envelope>
- <SOAP-ENV:Header>
- <xsl:choose>
- <xsl:when test="@useQueryNodeHeader='true'">
- <xts:queryNode select="/root/header/*[local-name()='biBusHeader']"/>
- </xsl:when>
- <xsl:otherwise>
- <!--
- The attribute name says it all, the xs namespace is used in xsi:type checking. This is a kluge, it forces the xs namespace to be defined
- and without it can cause grief for come chained requests.
- This must be defined since there are services that do strong xsi:type namespaced value checking and when that namespace is
- ABSENT, errors will occur! THIS HAS NO IMPACT ON THE REQUEST ITSELF!
- -->
- <bus:biBusHeader xsi:type="bus:biBusHeader" xs:usedIn="xsi_type_checking">
- <out:choose>
- <out:when test="/root/header/*[local-name()='biBusHeader']">
- <!-- Handle tracking info passed in as m_tracking -->
- <xsl:choose>
- <!-- If the attribute directedRequest is present, then it's a xpath to a dispatcher. Make sure we add it's value as a child of trakking. -->
- <xsl:when test="string(@directedRequest) != ''">
- <bus:tracking xsi:type="bus:tracking">
- <out:copy-of select="/root/header/bus:biBusHeader/bus:tracking/*[local-name()!='conversationContext']"/>
- <bus:conversationContext xsi:type="bus:conversationContext">
- <out:copy-of select="/root/header/bus:biBusHeader/bus:tracking/bus:conversationContext/*[local-name()!='nodeID']"/>
- <nodeID xsi:type="xsd:string">
- <out:value-of select="{@directedRequest}"/>
- </nodeID>
- </bus:conversationContext>
- </bus:tracking>
- </xsl:when>
- <xsl:otherwise>
- <out:choose>
- <out:when test="/root/env/param[@name='m_tracking'] and /root/env/param[@name='m_tracking']!='' and ('{@affinity}'='.high' or '{@affinity}'='.absolute' or '{@affinity}'='.control')">
- <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>
- </xsl:otherwise>
- </xsl:choose>
- <!-- set up the rest of the header elements -->
- <out:for-each select="/root/header/bus:biBusHeader/*">
- <out:choose>
- <!-- if there is a specified ui.routingServerGroup - then wipe existing one, new routing possible -->
- <out:when test="local-name()='routing' and string(/root/env/param[@name='ui.routingServerGroup'])!=''"/>
- <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="@*"/>
- <out:choose>
- <!-- We will only forward the for parameter if the advanced setting "forwardParamsToCM" is set to true -->
- <out:when test="not(/root/configProps/param[@name='cc']/property[@name='forwardURLParamsToCM'] = 'true')">
- <bus:formFieldVars xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:formFieldVar[]">
- <out:copy-of select="bus:formFieldVars/item[starts-with(name, 'CAM')]"/>
- </bus:formFieldVars>
- <out:copy-of select="*[local-name() != 'formFieldVars']"/>
- </out:when>
- <out:otherwise>
- <out:copy-of select="*"/>
- </out:otherwise>
- </out:choose>
- </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:when test="local-name()='dispatcherTransportVars'">
- <xsl:choose>
- <xsl:when test="starts-with(@provider, 'cm')">
- <!-- add requester re:RTC story 37223 -->
- <out:copy>
- <out:copy-of select="@*"/>
- <item xsi:type="bus:dispatcherTransportVar">
- <name xsi:type="xsd:string">requester</name>
- <value xsi:type="xsd:string">
- <xsl:choose>
- <xsl:when test="@requester and string(@requester) != '' ">
- <xsl:value-of select="@requester"/>
- </xsl:when>
- <xsl:otherwise><xsl:text/>ps<xsl:text/></xsl:otherwise>
- </xsl:choose>
- </value>
- </item>
- <out:copy-of select="*"/>
- </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:choose>
- <!-- routing required, allow routing tag to be passed in request re:RTC 14922 bulk migration task-->
- <xsl:choose>
- <xsl:when test="@routing">
- <bus:routing xsi:type="bus:routingInfo">
- <routingServerGroup><xsl:value-of select="@routing"/></routingServerGroup>
- </bus:routing>
- </xsl:when>
- <xsl:otherwise>
- <out:if test="string(/root/env/param[@name='ui.routingServerGroup'])!=''">
- <bus:routing xsi:type="bus:routingInfo">
- <routingServerGroup>
- <out:value-of select="/root/env/param[@name='ui.routingServerGroup']"/>
- </routingServerGroup>
- </bus:routing>
- </out:if>
- </xsl:otherwise>
- </xsl:choose>
- </bus:biBusHeader>
- </xsl:otherwise>
- </xsl:choose>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <xsl:apply-templates/>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xts:request>
- </xsl:template>
- <!--Request helpers begins-->
- <xsl:template match="reqhelpers:request">
- <xts:request>
- <xsl:for-each select="./@*">
- <xsl:choose>
- <xsl:when test="name() = 'soapAction'">
- <xsl:attribute name="soapAction">
- <xsl:call-template name="reqhelpers-expand-macros">
- <xsl:with-param name="map" select="$soapaction-map"/>
- <xsl:with-param name="value" select="."/>
- </xsl:call-template>
- </xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="{name()}">
- <xsl:value-of select="."/>
- </xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- <xsl:apply-templates/>
- </xts:request>
- </xsl:template>
- <xsl:template name="reqhelpers-expand-macros">
- <xsl:param name="map"/>
- <xsl:param name="value"/>
- <xsl:variable name="p">
- <xsl:if test="contains($value, '$')"><xsl:value-of select="substring-after($value, '$')"/></xsl:if>
- </xsl:variable>
- <xsl:variable name="q">
- <xsl:if test="contains($p, '$')"><xsl:value-of select="substring-before($p, '$')"/></xsl:if>
- </xsl:variable>
- <xsl:variable name="name" select="concat('$', $q, '$')"/>
- <xsl:choose>
- <xsl:when test="$map/entry[@name=$name]">
- <xsl:value-of select="xtsext:replace($value, $name, $map/entry[@name=$name])"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$value"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!--Request helpers ends-->
- <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>
|