123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- <?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/gethandler.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="wsdl" type="exec" mode="interpret" processor="XSLT" condition=".[/root/env/param[@name = 'wsdl']]">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <xsl:if test="string(/root/interfaces/interfaceInfo/param[@name = 'extraInfo']) != '/cps4/portlets/cmm'">
- <xsl:for-each select="/root/interfaces/interfaceInfo[param[@name = 'virtualPath'] != '']">
- <xts:sequence>
- <xts:append>
- <xts:request protocol="FILEREAD" target="{ /root/interfaces/interfaceInfo/param[@name = 'extraInfo'] }/implementation.xml" faultBlock="interfaceFault"/>
- </xts:append>
- </xts:sequence>
- </xsl:for-each>
- </xsl:if>
- <!-- get gateway to determine protocol scheme (ie. https) and CpsProtocolScheme override property -->
- <xts:sequence>
- <xts:append>
- <xts:function name="getConfiguration">
- <xts:param name="gateway"/>
- <xts:param name="CPSProtocolScheme"/>
- </xts:function>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="interfaceFault" type="fault" processor="XSLT">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <error>
- <xsl:copy-of select="/root/fault/*"/>
- </error>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="wsdl_service" dependency="wsdl" type="exec" processor="XSLT" mode="interpret">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xts xtsext">
- <xsl:variable name="http-param" select="/root/http/param"/>
- <xsl:variable name="config-property" select="/root/configuration/property"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:append select="/root/output">
- <xsl:choose>
- <xsl:when test="/root/error">
- <xos:statusCode xmlns:xos="http://developer.cognos.com/schemas/xts/output/">404</xos:statusCode>
- </xsl:when>
- <xsl:otherwise>
- <!--
- NOTE: The CGI 1.1 interface does not describe the protocol scheme (ie. https) so the following
- rules are used to return the correct scheme.
- 1) A server property called CPSProtocolScheme may be defined to override everything. The values
- for this property are either "http" or "https".
- 2) The configuration gateway parameter's protocol scheme is used.
- Since multiple gateways may be used, the rest of the configuration gateway parameter is discarded and
- the URI is reconstructed from the incomming http parameters.
- -->
- <xsl:variable name="cps-protocol-scheme" select="$config-property[@name = 'CPSProtocolScheme']"/>
- <xsl:variable name="gateway" select="$config-property[@name = 'gateway']"/>
- <xsl:variable name="gateway-scheme">
- <xsl:if test="contains($gateway, '://')">
- <xsl:value-of select="substring-before($gateway, '://')"/>
- </xsl:if>
- </xsl:variable>
- <xsl:variable name="protocol">
- <xsl:choose>
- <xsl:when test="$cps-protocol-scheme != ''">
- <xsl:value-of select="$cps-protocol-scheme"/>
- </xsl:when>
- <xsl:when test="$gateway-scheme != ''">
- <xsl:value-of select="$gateway-scheme"/>
- </xsl:when>
- <xsl:otherwise>http</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!--
- NOTE: Support for the http param REQUEST_URI has been removed but may be required if this code is ported back to series 7.
- -->
-
- <xsl:variable name="path_info">
- <xsl:value-of select="$http-param[@name = 'PATH_INFO']"/>
- </xsl:variable>
-
- <xsl:variable name="server_gateway">
- <xsl:value-of select="concat($protocol, '://')"/>
- <xsl:value-of select="$http-param[@name = 'SERVER_NAME']"/>
- <xsl:if test="$http-param[@name = 'SERVER_PORT'] != '' and $http-param[@name = 'SERVER_PORT'] != '80'">
- <xsl:text>:</xsl:text>
- <xsl:value-of select="$http-param[@name = 'SERVER_PORT']"/>
- </xsl:if>
- <xsl:value-of select="$http-param[@name = 'SCRIPT_NAME']"/>
- </xsl:variable>
-
- <xsl:variable name="request-uri">
- <xsl:value-of select="$server_gateway"/>
- <xsl:value-of select="$path_info"/>
- </xsl:variable>
-
- <xsl:variable name="markup-binding">
- <xsl:choose>
- <xsl:when test="contains($path_info, '/wsrp/cps4/portlets/cmm')">
- <xsl:value-of select="$server_gateway"/>
- <xsl:text>/wsrp/fragments/markup/handle/cmm/edit:generic</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$request-uri"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="producer-xml" select="xtsext:web64encode('/WEB-INF/fragments/producers/cmm/', true())"/>
- <xsl:variable name="service-description-binding">
- <xsl:choose>
- <xsl:when test="contains($path_info, '/wsrp/cps4/portlets/cmm')">
- <xsl:value-of select="$server_gateway"/>
- <xsl:text>/wsrp/fragments/description/producerxml/</xsl:text>
- <xsl:value-of select="$producer-xml"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$request-uri"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="registration-binding">
- <xsl:choose>
- <xsl:when test="contains($path_info, '/wsrp/cps4/portlets/cmm')">
- <xsl:value-of select="$server_gateway"/>
- <xsl:text>/wsrp/fragments/registration/producerxml/</xsl:text>
- <xsl:value-of select="$producer-xml"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$request-uri"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="portlet-management-binding">
- <xsl:choose>
- <xsl:when test="contains($path_info, '/wsrp/cps4/portlets/cmm')">
- <xsl:value-of select="$server_gateway"/>
- <xsl:text>/wsrp/fragments/management</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$request-uri"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <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>
- <wsdl:definitions targetNamespace="urn:oasis:names:tc:wsrp:v1:wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:bind="urn:oasis:names:tc:wsrp:v1:bind" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:import namespace="urn:oasis:names:tc:wsrp:v1:bind" location="http://www.oasis-open.org/committees/wsrp/specifications/version1/wsrp_v1_bindings.wsdl"/>
- <wsdl:service name="WSRPService">
- <xsl:variable name="extension" select="/root/implementation/extension"/>
- <xsl:apply-templates select="$extension/*[local-name()='segment']" mode="copy"/>
- <wsdl:port binding="bind:WSRP_v1_Markup_Binding_SOAP" name="WSRPBaseService">
- <soap:address location="{ $markup-binding }"/>
- <xsl:apply-templates select="$extension/*[local-name()='port' and @name='WSRPBaseService']/*[local-name()='portletAddress']" mode="copy"/>
- </wsdl:port>
- <wsdl:port binding="bind:WSRP_v1_ServiceDescription_Binding_SOAP" name="WSRPServiceDescriptionService">
- <soap:address location="{ $service-description-binding }"/>
- <xsl:apply-templates select="$extension/*[local-name()='port' and @name='WSRPServiceDescriptionService']/*[local-name()='portletAddress']" mode="copy"/>
- </wsdl:port>
- <wsdl:port binding="bind:WSRP_v1_Registration_Binding_SOAP" name="WSRPRegistrationService">
- <soap:address location="{ $registration-binding }"/>
- <xsl:apply-templates select="$extension/*[local-name()='port' and @name='WSRPRegistrationService']/*[local-name()='portletAddress']" mode="copy"/>
- </wsdl:port>
- <wsdl:port binding="bind:WSRP_v1_PortletManagement_Binding_SOAP" name="WSRPPortletManagementService">
- <soap:address location="{ $portlet-management-binding }"/>
- <xsl:apply-templates select="$extension/*[local-name()='port' and @name='WSRPPortletManagementService']/*[local-name()='portletAddress']" mode="copy"/>
- </wsdl:port>
- </wsdl:service>
- </wsdl:definitions>
- </xos:entityBody>
- </xos:part>
- </xsl:otherwise>
- </xsl:choose>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- <!-- Using xsl:copy-of will sometime cause a namespace leak. To fix this, we use this template to copy the elements -->
- <xsl:template match="*" mode="copy">
- <xsl:element name="{name()}" namespace="{namespace-uri()}">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="copy"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="text()" mode="copy">
- <xsl:value-of select="."/>
- </xsl:template>
- </xsl:stylesheet>
-
- </xts:block>
- <xts:block id="resource" type="exec" mode="interpret" processor="XSLT" condition=".[not(/root/env/param[@name = 'wsdl'])]">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="/">
- <xts:sequence>
- <xts:append select="/root/output">
- <xts:request protocol="FILEREAD" target="{ /root/interfaces/interfaceInfo/param[@name = 'extraInfo'] }" mimeType="image/gif" option="part" faultBlock="resourceFault"/>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="resourceFault" type="fault" processor="XSLT">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
- <xsl:template match="/">
- <xos:statusCode xmlns:xos="http://developer.cognos.com/schemas/xts/output/">404</xos:statusCode>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|