123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (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).
- -->
- <!-- $Header: //cpscrn/main/templates/cps4/common/logicsheets/soaplogic.xslt#1 $ -->
- <!-- $DateTime: 2008/10/22 11:12:04 $ -->
- <!-- $Change: 25109 $ -->
- <!--
- CPS Portal Services
- SOAP Logicsheet
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:out="dummy-uri"
- xmlns:soap="http://developer.cognos.com/schemas/cps/logic/soap"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cpx="http://developer.cognos.com/schemas/cps/header/service/1/"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <!--
- soap:request
-
- built-in requests:
- @provider = 'cm' | 'cm2' | 'warp' | 'xts' | 'dispatcher' | 'jsm' | 'jobservice' | 'system'
- otherwise treated as a SOAP request and you must supply any of:
- @target
- @soapAction
- @outputHeader
- @protocolHeader
- @option
- @mimeType
- @faultBlock
- @directedRequest
- @afinity
-
- note: always returns response envelope
- -->
- <xsl:template match="soap:request">
- <xsl:choose>
- <xsl:when test="@provider = 'massembler'">
- <xts:transform processor="XSLT" src="/cps4/asm/transforms/asm-rewrite.xslt">
- <root>
- <xsl:for-each select="xts:param">
- <param name="{ @name }">
- <xsl:copy-of select="node()"/>
- </param>
- </xsl:for-each>
- <envelope>
- <xsl:call-template name="request-content">
- <xsl:with-param name="content" select="*[not(self::xts:param)]"/>
- </xsl:call-template>
- </envelope>
- <markup>
- <xts:request protocol="SOAP" responseEnvelope="true" target="interface://cps/assembler">
- <xsl:copy-of select="@soapAction | @outputHeader"/>
- <xsl:call-template name="request-content">
- <xsl:with-param name="content" select="*[not(self::xts:param)]"/>
- </xsl:call-template>
- </xts:request>
- </markup>
- </root>
- </xts:transform>
- </xsl:when>
- <xsl:otherwise>
-
- <xts:request>
- <xsl:choose>
- <xsl:when test="@responseEnvelope='false'">
- <xsl:attribute name="responseEnvelope">false</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="responseEnvelope">true</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
-
- <!-- select attributes for 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='cm2'">
- <xsl:attribute name="protocol">CM</xsl:attribute>
- <xsl:attribute name="href">cm://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='warp'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction">http://developer.cognos.com/schemas/bibus/2#reportService<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">xts.run</xsl:attribute>
- <xsl:attribute name="outputHeader">true</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">http://developer.cognos.com/schemas/bibus/2#dispatcher</xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='jsm'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction">http://developer.cognos.com/schemas/bibus/2#scheduler</xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='jobService'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction">jobService</xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='system'">
- <xsl:attribute name="protocol">BUS</xsl:attribute>
- <xsl:attribute name="href">bus://dispatcher</xsl:attribute>
- <xsl:attribute name="soapAction">http://developer.cognos.com/schemas/bibus/2#systemService</xsl:attribute>
- <xsl:attribute name="outputHeader">true</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='assembler'">
- <xsl:attribute name="protocol">ASSEMBLER</xsl:attribute>
- <xsl:attribute name="target">unused</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='consumer'">
- <xsl:attribute name="protocol">CONSUMER</xsl:attribute>
- <xsl:attribute name="target">unused</xsl:attribute>
- </xsl:when>
- <xsl:when test="@provider='storage'">
- <xsl:attribute name="protocol">STORAGE</xsl:attribute>
- <xsl:attribute name="target">unused</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="protocol">SOAP</xsl:attribute>
- <xsl:copy-of select="@target | @href | @soapAction | @outputHeader"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="request-content"/>
- </xts:request>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="request-content">
- <xsl:param name="content" select="*"/>
- <xsl:copy-of select="@option | @mimeType | @protocolHeader | @faultBlock"/>
- <!--
- Cookies
- the cookies attribute hold an xpath statement of the location of a cookie collection
- the cookies collection is an array of elements with name attribute and content
- -->
- <xsl:if test="@cookies">
- <out:variable name="cookies{ generate-id() }" select="{ @cookies }"/>
- <out:if test="$cookies{ generate-id() }">
- <xts:param name="header">
- <out:text>Cookie=</out:text>
- <out:for-each select="$cookies{ generate-id() }">
- <out:value-of select="@name"/>
- <out:text>=</out:text>
- <out:value-of select="."/>
- <out:if test="position() != last()">
- <out:text>; </out:text>
- </out:if>
- </out:for-each>
- </xts:param>
- </out:if>
- </xsl:if>
- <!-- copy any xts:output-param elements -->
- <xsl:copy-of select="*[local-name()='output-param']"/>
- <!-- envelope -->
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Header xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
- <xsl:call-template name="bibus-header"/>
- <xsl:call-template name="service-header">
- <xsl:with-param name="tracking-headers" select="soap:cpx-tracking"/>
- </xsl:call-template>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <xsl:apply-templates select="$content"/>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xsl:template>
-
- <xsl:template match="soap:cpx-tracking">
- <xsl:choose>
- <xsl:when test="parent::soap:request">
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="soap:cpx-tracking-param">
- <out:variable name="{@name}" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/*[local-name()='serviceHeader']/*[local-name()='traceRequest']/*[local-name()='service']/*[local-name()='tracking']/*[local-name()='param' and @name='{@name}']"/>
- </xsl:template>
-
-
- <!--
- soap:response
- -->
- <xsl:template match="soap:response">
- <xos:part xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
- <xos:entityHeader>
- <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
- </xos:entityHeader>
- <xos:entityBody>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Header>
- <xsl:call-template name="bibus-response"/>
- <xsl:call-template name="service-response"/>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <xsl:apply-templates/>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xos:entityBody>
- </xos:part>
- </xsl:template>
-
- <!--
- BIBUS Support
- -->
- <xsl:template name="bibus-header">
- <out:variable name="bibus-header" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader"/>
- <out:variable name="bibus" select="/root/header/bus:biBusHeader[not($bibus-header)] | $bibus-header"/>
- <out:if test="$bibus">
- <bus:biBusHeader xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="bus:biBusHeader">
-
- <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="@directedRequest != ''">
- <bus:tracking xsi:type="bus:tracking">
- <out:copy-of select="$bibus/bus:tracking/*[local-name() != 'conversationContext']"/>
- <bus:conversationContext xsi:type="bus:conversationContext">
- <out:copy-of select="$bibus/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'">
- <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="$bibus/bus:tracking"/>
- </out:otherwise>
- </out:choose>
- </xsl:otherwise>
- </xsl:choose>
- <!-- set up the rest of the header elements -->
- <out:for-each select="$bibus/*">
- <out:choose>
- <out:when test="local-name()='tracking'"/>
- <out:when test="local-name()='setCookieVars'"/>
- <out:when test="local-name()='cookieVars'"/>
- <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>
- <!-- cookies -->
- <xsl:if test="@cookies">
- <!--
- HACK ALERT:
- THIS DISPATCHER DOESN'T CURRENTLY SUPPORT PASSING HTTP COOKIES TO IT'S REQUEST HANDLERS,
- FOR SOAP REQUESTS. TO GET IB19 WORKING WE'LL CREATE BUS COOKIE ELEMENTS, IN ADDITION TO
- THE USUAL HTTP COOKIES.
- -->
- <out:if test="$cookies{ generate-id() }">
- <bus:hdrSession xsi:type="bus:hdrSession">
- <bus:cookieVars xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:cookieVar[]">
- <out:for-each select="$cookies{ generate-id() }">
- <item>
- <name xsi:type="xsd:string">
- <out:value-of select="@name"/>
- </name>
- <value xsi:type="xsd:string">
- <out:value-of select="."/>
- </value>
- </item>
- </out:for-each>
- </bus:cookieVars>
- </bus:hdrSession>
- </out:if>
- </xsl:if>
- </bus:biBusHeader>
- </out:if>
- </xsl:template>
- <xsl:template name="bibus-response">
- <out:copy-of select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader"/>
- </xsl:template>
- <!--
- Cognos Web Service Headers
- -->
- <xsl:template name="service-header">
- <xsl:param name="tracking-headers"/>
- <cpx:serviceHeader>
- <cpx:traceRequest>
- <cpx:service>
- <cpx:operation>
- <xsl:value-of select="name(*[1])"/>
- </cpx:operation>
- <cpx:namespace>
- <xsl:value-of select="namespace-uri(*[1])"/>
- </cpx:namespace>
- <cpx:target>
- <out:value-of select="'{@target}'"/>
- </cpx:target>
- <cpx:tracking>
- <xsl:for-each select="$tracking-headers">
- <cpx:param name="{@name}">
- <out:value-of select="{@select}"/>
- </cpx:param>
- </xsl:for-each>
- <out:copy-of select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/cpx:serviceHeader/cpx:traceRequest/cpx:service/cpx:tracking/cpx:param"/>
- </cpx:tracking>
- <!--
- <cpx:timeRequest>
- <xts:function name="getTimer"/>
- </cpx:timeRequest>
- -->
- </cpx:service>
- </cpx:traceRequest>
- </cpx:serviceHeader>
- </xsl:template>
- <xsl:template name="service-response">
- <out:variable name="serviceHeader" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/cpx:serviceHeader"/>
- <out:if test="$serviceHeader">
- <out:variable name="traceRequest" select="$serviceHeader/cpx:traceRequest"/>
- <out:variable name="service" select="$traceRequest/cpx:service"/>
- <cpx:serviceHeader>
- <out:if test="$traceRequest">
- <cpx:traceResponse>
- <cpx:service>
- <out:copy-of select="$service/*"/>
- <!--
- <out:if test="$service/cpx:timeRequest">
- <cpx:timeResponse>
- <xts:function name="getTimer"/>
- </cpx:timeResponse>
- </out:if>
- -->
- <cpx:traceOutput>
- <out:value-of select="/root/debug/traceRequestPath"/>
- </cpx:traceOutput>
- <xts:queryNode select="//*[local-name() = 'traceResponse']/*"/>
- </cpx:service>
- </cpx:traceResponse>
- </out:if>
- </cpx:serviceHeader>
- </out:if>
- </xsl:template>
-
- <xsl:template match="*|@*|text()|processing-instruction()">
- <xsl:copy>
- <xsl:apply-templates select="*|@*|text()|processing-instruction()"/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|