123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (C) Copyright IBM Corp. 2005, 2011
- 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-impl/RegistrationServiceImpl.xts#1 $ -->
- <!-- $DateTime: 2008/10/22 11:12:04 $ -->
- <!-- $Change: 25109 $ -->
- <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/">
- <xts:block id="execution" type="exec" mode="interpret" processor="XSLT" nodelist="envelope,implementation">
- <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:xos="http://developer.cognos.com/schemas/xts/output/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
- <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="op-name" select="local-name($op)"/>
- <xsl:variable name="version" select="/root/implementation/@version"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:append select="/root/output">
- <xos:part>
- <xos:entityHeader>
- <xos:param name="Content-type">text/xml</xos:param>
- </xos:entityHeader>
- <xos:entityBody>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <xsl:choose>
- <xsl:when test="$op-name = 'register'">
- <wsrp:registerResponse>
- <wsrp:registrationHandle>
- <xsl:value-of select="xtsext:generateGUID()"/>
- </wsrp:registrationHandle>
- <wsrp:registrationState>
- <xsl:call-template name="create-state">
- <xsl:with-param name="data" select="$op"/>
- </xsl:call-template>
- </wsrp:registrationState>
- <xsl:if test="$version">
- <wsrp:extensions>
- <cpsext:version xmlns:cpsext="http://developer.cognos.com/schemas/cps/wsrp/extensions/1/"><xsl:value-of select="$version"/></cpsext:version>
- </wsrp:extensions>
- </xsl:if>
- </wsrp:registerResponse>
- </xsl:when>
- <xsl:when test="$op-name = 'modifyRegistration'">
- <wsrp:modifyRegistrationResponse>
- <wsrp:registrationState>
- <xsl:call-template name="create-state">
- <xsl:with-param name="data" select="$op/wsrp:registrationData"/>
- </xsl:call-template>
- </wsrp:registrationState>
- </wsrp:modifyRegistrationResponse>
- </xsl:when>
- <xsl:when test="$op-name = 'deregister'">
- <wsrp:deregisterResponse/>
- </xsl:when>
- </xsl:choose>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xos:entityBody>
- </xos:part>
- </xts:append>
- </xts:sequence>
- </xsl:template>
-
- <xsl:template name="create-state">
- <xsl:param name="data"/>
-
- <xsl:variable name="state">
- <!-- consumerAgent -->
- <xsl:call-template name="gen-param">
- <xsl:with-param name="name" select="'consumerAgent'"/>
- <xsl:with-param name="value">
- <xsl:variable name="agent" select="$data/wsrp:consumerAgent"/>
- <xsl:choose>
- <xsl:when test="contains($agent, 'WebSphere')">websphere</xsl:when>
- <xsl:when test="contains($agent, 'Liferay')">liferay</xsl:when>
- <xsl:when test="contains($agent, 'Plumtree')">plumtree</xsl:when>
- <xsl:when test="contains($agent, 'SAP')">sap</xsl:when>
- <xsl:when test="contains($agent, 'Cognos')">cognos</xsl:when>
- <xsl:when test="contains($agent, 'Sharepoint')">sharepoint</xsl:when>
- <xsl:otherwise>default</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- <!-- properties -->
- <xsl:for-each select="$data/wsrp:registrationProperties">
- <xsl:call-template name="gen-param">
- <xsl:with-param name="name" select="@name"/>
- <xsl:with-param name="value" select="wsrp:stringValue"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="xtsext:base64encode( string( $state ), true())"/>
- </xsl:template>
- <xsl:template name="gen-param">
- <xsl:param name="name" select="@name"/>
- <xsl:param name="value" select="wsrp:value"/>
- <xsl:text><param name="</xsl:text>
- <xsl:value-of select="$name"/>
- <xsl:text>"></xsl:text>
- <xsl:value-of select="xtsext:xmlencode(string($value))"/>
- <xsl:text></param></xsl:text>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|