123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (C) Copyright IBM Corp. 2005, 2013
- 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/producer/wsrp_driver.xts#1 $ -->
- <!-- $DateTime: 2008/10/22 11:12:04 $ -->
- <!-- $Change: 25109 $ -->
- <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="/cps4/producer/messages/cpsproducermsgs.xml">
- <!-- perform schema validations of the request -->
- <xts:block id="validate" type="exec" mode="interpret" processor="XML" condition=".[/root/system/param[@name = 'validate'] = 'true']" mandatory="false">
- <xts:sequence>
- <xts:discard>
- <xts:transform name="VALIDATE" faultBlock="fault_validate">
- <xts:param name="systemId"><xts:queryValue select="/root/interfaces/interfaceInfo/param[@name='morphlet']"/>@request</xts:param>
- <xts:param name="schemaLocation">http://schemas.xmlsoap.org/soap/envelope/ /cps4/producer/schemas/soap_v11.xsd</xts:param>
- <xts:param name="schemaLocation">urn:oasis:names:tc:wsrp:v1:types /cps4/producer/schemas/wsrp_v1_types.xsd</xts:param>
- <xts:param name="schemaLocation">http://www.w3.org/XML/1998/namespace /cps4/producer/schemas/xml.xsd</xts:param>
- <xts:queryNode select="/root/envelope/*"/>
- </xts:transform>
- </xts:discard>
- </xts:sequence>
- </xts:block>
- <!-- read the actual implementation based on the path info, if it's valid -->
- <xts:block id="read_impl" nodelist="interfaces" dependency="validate" type="exec" mode="interpret" processor="XSLT">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:append>
- <xts:request protocol="FILEREAD" target="{ /root/interfaces/interfaceInfo/param[@name = 'extraInfo'] }/implementation.xml" faultBlock="fault_no_impl"/>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- read the basic framework implementation -->
- <xts:block id="read_framework" dependency="read_impl" type="exec" mode="input" processor="XML" path="/cps4/producer/implementation.xml"/>
- <!-- validate the parameters -->
- <xts:block id="validate_params" dependency="read_impl read_framework" type="exec" mode="interpret" processor="XSLT" mandatory="false">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xtsext xts">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:append>
- <xsl:variable name="decoded-navigationalState">
- <xsl:if test="/root/envelope/*[local-name()='Envelope']/*[local-name()='Body']/*[1]/*[local-name()='markupParams']/*[local-name()='navigationalState']">
- <xsl:value-of select="xtsext:base64decode(xtsext:validator('verify','navigationalState',string(/root/envelope/*[local-name()='Envelope']/*[local-name()='Body']/*[1]/*[local-name()='markupParams']/*[local-name()='navigationalState'])), true())" disable-output-escaping="yes"/>
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="decoded-portletState">
- <xsl:if test="/root/envelope/*[local-name()='Envelope']/*[local-name()='Body']/*[1]/*[local-name()='portletContext']/*[local-name()='portletState']">
- <xsl:value-of select="xtsext:base64decode(/root/envelope/*[local-name()='Envelope']/*[local-name()='Body']/*[1]/*[local-name()='portletContext']/*[local-name()='portletState'], true())" disable-output-escaping="yes"/>
- </xsl:if>
- </xsl:variable>
-
- <decodedStates>
- <navigationalState><xsl:value-of select="$decoded-navigationalState"/></navigationalState>
- <portletState><xsl:value-of select="$decoded-portletState"/></portletState>
- </decodedStates>
-
-
- <xsl:variable name="namespace">
- <xsl:text>urn:cognos:portlets:validator:</xsl:text><xsl:value-of select="xtsext:substringAfterLast( string( /root/interfaces/interfaceInfo/param[@name='extraInfo'] ), '/' )"/>
- </xsl:variable>
- <xsl:variable name="op" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]"/>
- <xsl:variable name="op-name" select="local-name($op)"/>
- <xsl:variable name="back-url" select="/root/envelope/*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='biBusHeader']/*[local-name()='hdrSession']/*[local-name()='formFieldVars']/item[name='backURL']/value"/>
- <xsl:if test="$op-name = 'performBlockingInteraction' or not($decoded-portletState = '') or not($decoded-navigationalState = '') or ($back-url != '')">
- <xts:transform name="VALIDATOR" faultBlock="fault_validate_parms">
- <xts:param name="action">verify</xts:param>
- <xts:param name="namespace"><xsl:value-of select="$namespace"/></xts:param>
- <xts:param name="validatorLocation">
- <xsl:value-of select="$namespace"/><xsl:text> </xsl:text><xsl:value-of select="/root/interfaces/interfaceInfo/param[@name = 'extraInfo']"/><xsl:text>/validator.xml</xsl:text></xts:param>
- <xts:param name="validatorLocation">urn:cognos:portlets:validator <xsl:value-of select="xtsext:substringBeforeLast( string( /root/interfaces/interfaceInfo/param[@name='extraInfo'] ), '/' )"/><xsl:text>/validator.xml</xsl:text></xts:param>
- <validatorParams>
- <xsl:if test="($back-url != '')">
- <param name="backURL"><xsl:value-of select="$back-url"/></param>
- </xsl:if>
- <xts:queryNode select="/root/envelope/*[local-name()='Envelope']/*[local-name()='Body']/*[1]/*[local-name()='interactionParams']/*[local-name()='formParameters']"/>
- <xsl:value-of select="$decoded-portletState" disable-output-escaping="yes"/>
- <xsl:value-of select="$decoded-navigationalState" disable-output-escaping="yes"/>
- </validatorParams>
- </xts:transform>
- </xsl:if>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- execute the XTS implementation (either the target implementer or the framework -->
- <xts:block id="exec_impl" nodelist="envelope,implementation,framework,setCookies,cookies,interfaces,configProps,decodedStates" dependency="validate_params" type="exec" mode="interpret" processor="XSLT" condition=".[not(/root/error)]" mandatory="false">
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:cpsext="http://developer.cognos.com/schemas/cps/wsrp/extensions/1/"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- exclude-result-prefixes="xtsext xts">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:variable name="op" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]"/>
- <xsl:variable name="command" select="local-name( $op )"/>
- <xsl:variable name="handle" select="substring-before( concat( $op/wsrp:portletContext/wsrp:portletHandle, ':' ), ':' )"/>
- <xsl:variable name="portlet" select="/root/implementation/portlet[@handle = $handle]"/>
- <xsl:variable name="method" select="$portlet/method[@name = $command] | /root/implementation/method[@name = $command] | /root/framework/method[@name = $command]"/>
- <xsl:variable name="decodeStates" select="not($method/@decodeStates) or $method/@decodeStates='true'"/>
- <xsl:variable name="decoded-registration">
- <xsl:if test="($decodeStates = 'true' or not($portlet/method[@name = 'register'] | /root/implementation/method[@name = 'register']) ) and $op/wsrp:registrationContext/wsrp:registrationState != ''">
- <xsl:value-of select="xtsext:base64decode(string($op/wsrp:registrationContext/wsrp:registrationState), true())"/>
- </xsl:if>
- </xsl:variable>
-
- <xsl:template match="/">
- <xts:sequence>
- <xsl:choose>
- <xsl:when test="$method">
- <xsl:variable name="requestType" select="$method/@requestType"/>
- <xts:append select="/root/output">
- <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>
- <xsl:choose>
- <xsl:when test="not($requestType) or $requestType='XTS'">
- <xts:request name="XTS" faultBlock="fault_handler" target="{ $method[1] }" protocolHeader="true" protocolHeaderSelect="/root/output">
- <xsl:apply-templates select="/root/envelope" mode="patch-prefix"/>
- <system>
- <xsl:apply-templates select="/root/implementation/property-description | $portlet/property-description" mode="system"/>
- </system>
- <cookies>
- <xsl:apply-templates select="/root/setCookies/cookie | /root/cookies/cookie[not(@name = /root/setCookies/cookie/@name)]" mode="patch-prefix" />
- </cookies>
- <xsl:copy-of select="/root/setCookies"/>
- <xsl:copy-of select="/root/interfaces"/>
- <xsl:if test="name( $method[1]/.. ) = 'framework'">
- <xts:queryNode select="/root/implementation"/>
- </xsl:if>
- </xts:request>
- </xsl:when>
- <xsl:when test="$requestType='CPS-URL'">
- <xts:request name="XTS" faultBlock="fault_handler" target="/cps4/producer/wsrp-impl/cps-urlhandler.xts" protocolHeader="true" protocolHeaderSelect="/root/output">
- <xsl:apply-templates select="/root/envelope" mode="patch-prefix"/>
- <cookies>
- <xsl:apply-templates select="/root/setCookies/cookie | /root/cookies/cookie[not(@name = /root/setCookies/cookie/@name)]" mode="patch-prefix" />
- </cookies>
- <xsl:copy-of select="/root/setCookies"/>
-
- <xsl:if test="contains($method[1], 'internalDispatcher')">
- <internalRequest/>
- </xsl:if>
-
- <xsl:variable name="target">
- <xsl:call-template name="substituteConfigSettings">
- <xsl:with-param name="input" select="$method[1]"/>
- </xsl:call-template>
- </xsl:variable>
-
- <target>
- <xsl:value-of select="$target"/>
- </target>
- </xts:request>
- </xsl:when>
- <xsl:otherwise>
- <xts:request name="{ $requestType }" faultBlock="fault_handler" target="{ $method[1] }" >
- <xsl:if test="$method/@soapAction">
- <xsl:attribute name="soapAction"><xsl:value-of select="$method/@soapAction"/></xsl:attribute>
- <xsl:attribute name="responseEnvelope">true</xsl:attribute>
- </xsl:if>
- <xsl:apply-templates select="/root/envelope" mode="patch-prefix"/>
- </xts:request>
- </xsl:otherwise>
- </xsl:choose>
- </xos:entityBody>
- </xos:part>
- </xts:append>
- </xsl:when>
-
- <xsl:otherwise>
- <xts:append>
- <error>
- <noImpl/>
- </error>
- </xts:append>
- </xsl:otherwise>
- </xsl:choose>
- </xts:sequence>
- </xsl:template>
- <xsl:template name="substituteConfigSettings">
- <xsl:param name="input"/>
- <xsl:choose>
- <xsl:when test="$input and contains($input,'{')">
- <xsl:variable name="after" select="substring-after($input,'{')"/>
- <xsl:choose>
- <xsl:when test="$after and contains($input,'}')">
- <xsl:value-of select="substring-before($input,'{')"/>
- <xsl:variable name="config-prop" select="substring-before($after,'}')"/>
- <xsl:value-of select="/root/configProps/param[@name='cps']/property[@name=$config-prop]"/>
- <xsl:call-template name="substituteConfigSettings">
- <xsl:with-param name="input" select="substring-after($after,'}')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$input"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$input"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="property-description" mode="system">
- <param type="{ substring-after( @type, ':' ) }">
- <xsl:copy-of select="@*[name() != 'type']"/>
- <xsl:value-of select="default"/>
- </param>
- </xsl:template>
- <!-- The patch-prefix mode adds or fixes the WSRP namespace's prefix to be "wsrp:" -->
- <!-- Moreover, XSLTC can't handle properly namespaces without prefixes -->
- <!-- Finally, we base64decode stuff at the same time -->
- <xsl:template match="*[namespace-uri()='urn:oasis:names:tc:wsrp:v1:types']" priority="1" mode="patch-prefix">
- <xsl:element name="wsrp:{local-name()}" namespace="urn:oasis:names:tc:wsrp:v1:types">
- <xsl:choose>
- <xsl:when test="(local-name()='portletState' or local-name()='registrationState' or local-name()='navigationalState') and (. != '') and $decodeStates">
- <xsl:variable name="state-extension" select="parent::wsrp:portletContext/wsrp:extensions/cpsext:state/cpsext:externalRef"/>
-
-
- <xsl:choose>
- <xsl:when test="local-name()='portletState' and $state-extension">
- <xts:transform name="XSLT" src="/cps4/producer/wsrp-impl/transforms/portlet-state.xslt">
- <root>
- <state>
- <xsl:value-of select="/root/decodedStates/portletState" disable-output-escaping="yes"/>
- </state>
- <update>
- <xsl:copy-of select="$state-extension"/>
- </update>
- </root>
- </xts:transform>
- </xsl:when>
- <xsl:when test="local-name()='portletState'">
- <xsl:value-of select="/root/decodedStates/portletState" disable-output-escaping="yes"/>
- </xsl:when>
- <xsl:when test="local-name()='navigationalState'">
- <xsl:value-of select="/root/decodedStates/navigationalState" disable-output-escaping="yes"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="xtsext:base64decode(string(.), true())" disable-output-escaping="yes"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
-
-
- <xsl:otherwise>
- <xsl:apply-templates select="*|@*|text()" mode="patch-prefix"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*|@*|text()" priority="-1" mode="patch-prefix">
- <xsl:copy>
- <xsl:apply-templates select="*|@*|text()" mode="patch-prefix"/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- handle all implementation errors (not execution errors) -->
- <xts:block id="exec_fault" dependency="exec_impl" type="exec" mode="interpret" processor="XSLT" condition=".[/root/error]">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xts:sequence>
- <xsl:choose>
- <xsl:when test=".[/root/error/badParams]">
- <xts:append select="/root/output">
- <xts:transform processor="XML" cache="false" option="part">
- <xts:param name="messageBase"><xts:queryValue select="/root/interfaces/interfaceInfo/param[@name='location']"/>/messages/cpsproducermsgs.xml</xts:param>
- <xts:param name="systemId"><xts:queryValue select="/root/interfaces/interfaceInfo/param[@name='morphlet']"/>@exec_fault</xts:param>
- <xts:param name="mediaType">text/xml</xts:param>
- <xts:param name="encoding">utf-8</xts:param>
- <xts:param name="src">
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
- <faultcode xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types">wsrp:OperationFailed</faultcode>
- <faultstring><xts:string id="IDS_PRO_WSF_SECURITYREJECTION"/></faultstring>
- <detail>
- <wsrp:OperationFailed xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"/>
- </detail>
- </SOAP-ENV:Fault>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xts:param>
- </xts:transform>
- </xts:append>
- </xsl:when>
- <xsl:otherwise>
- <xts:append select="/root/output">
- <xts:transform processor="XML" cache="false" option="part">
- <xts:param name="messageBase"><xts:queryValue select="/root/interfaces/interfaceInfo/param[@name='location']"/>/messages/cpsproducermsgs.xml</xts:param>
- <xts:param name="systemId"><xts:queryValue select="/root/interfaces/interfaceInfo/param[@name='morphlet']"/>@exec_fault</xts:param>
- <xts:param name="mediaType">text/xml</xts:param>
- <xts:param name="encoding">utf-8</xts:param>
- <xts:param name="src">
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
- <faultcode xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types">wsrp:OperationFailed</faultcode>
- <faultstring><xts:string id="IDS_PRO_WSF_NOTIMPLEMENTEDFAULT"/></faultstring>
- <detail>
- <wsrp:OperationFailed xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"/>
- </detail>
- </SOAP-ENV:Fault>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xts:param>
- </xts:transform>
- </xts:append>
- </xsl:otherwise>
- </xsl:choose>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- indicate an invalid producer (wrong path-info) -->
- <xts:block id="fault_no_impl" type="fault" processor="XML">
- <error>
- <invalidProducer/>
- </error>
- </xts:block>
- <!-- catch request parameter validation errors -->
- <xts:block id="fault_validate_parms" type="fault" processor="XML">
- <error>
- <badParams/>
- </error>
- </xts:block>
-
- <!-- handle execution errors -->
- <xts:block id="fault_handler" type="fault" processor="XSLT">
- <xsl:stylesheet version="1.0"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
- <xsl:variable name="xts-fault" select="/root/fault/xts:exception[last()]"/>
- <xsl:choose>
- <xsl:when test="$xts-fault/xts:exceptionCode ='com.ibm.cognos.tds.TDSException' or contains($xts-fault/xts:exceptionDetail/bus:exception/bus:message/messageString,'CM-REQ-4159')">
- <!-- If we have a TDS error or CM-REQ-4159 , most likely it is an expired passport. We throw an invalidCookie fault to force an initCookie request -->
- <faultcode xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" wsrp:dummy="">wsrp:InvalidCookie</faultcode>
- <faultstring><xsl:value-of select="$xts-fault/xts:exceptionMsg"/></faultstring>
- <detail>
- <wsrp:InvalidCookie xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" />
- </detail>
- </xsl:when>
- <xsl:otherwise>
- <faultcode xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types">wsrp:OperationFailed</faultcode>
- <faultstring><xts:string id="IDS_PRO_WSF_OPERATIONFAILEDFAULT"/></faultstring>
- <detail>
- <wsrp:OperationFailed xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"/>
- <xsl:copy-of select="/root/fault/*"/>
- </detail>
- </xsl:otherwise>
- </xsl:choose>
- </SOAP-ENV:Fault>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- catch request validation errors -->
- <xts:block id="fault_validate" type="fault" processor="XSLT">
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:variable name="exception" select="/root/fault/xts:exception[last()]"/>
- <fault>
- <xts:exception>
- <xts:exceptionCode>RequestValidationFailed</xts:exceptionCode>
- <xts:exceptionMsg>
- <xsl:value-of select="$exception/xts:exceptionMsg"/>
- </xts:exceptionMsg>
- <xts:exceptionStackTrace>
- <xsl:value-of select="$exception/xts:exceptionStackTrace"/>
- </xts:exceptionStackTrace>
- <xts:exceptionDetail>
- <xsl:copy-of select="/root/envelope/*"/>
- </xts:exceptionDetail>
- </xts:exception>
- </fault>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|