gethandler.xts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cogadmin
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <!-- $Header: //cogadmin/main/prod/adminServer/templates/ps/cogadminWebService/impl_wsrf/gethandler.xts#3 $ -->
  13. <!-- $DateTime: 2010/03/31 17:10:53 $ -->
  14. <!-- $Change: 15977 $ -->
  15. <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  16. <xts:block id="get_interfaces" type="exec" processor="XSLT" mode="interpret">
  17. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  18. <xsl:template match="/">
  19. <xsl:for-each select="/root/interfaces/interfaceInfo[param[@name = 'virtualPath'] != '']">
  20. <xts:sequence>
  21. <xts:append>
  22. <xts:request protocol="FILEREAD" target="{ param[@name = 'location'] }/interface.xml" faultBlock="readfault"/>
  23. </xts:append>
  24. </xts:sequence>
  25. </xsl:for-each>
  26. <!-- get gateway to determine protocol scheme (ie. https) -->
  27. <xts:sequence>
  28. <xts:append>
  29. <xts:function name="getConfiguration">
  30. <xts:param name="gateway"/>
  31. </xts:function>
  32. </xts:append>
  33. </xts:sequence>
  34. </xsl:template>
  35. </xsl:stylesheet>
  36. </xts:block>
  37. <xts:block id="readfault" type="fault" processor="XSLT">
  38. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  39. <xsl:template match="/">
  40. <error>
  41. <xsl:copy-of select="/root/fault/*"/>
  42. </error>
  43. </xsl:template>
  44. </xsl:stylesheet>
  45. </xts:block>
  46. <!--
  47. request is for a wsrp producer endpoint
  48. load interface and handle wsrp namespace
  49. for first loaded interface
  50. load package info
  51. generate wsdl with only supported interfaces
  52. -->
  53. <xts:block id="wsdl_service" dependency="get_interfaces" type="exec" processor="XSLT" mode="interpret">
  54. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xts">
  55. <xsl:variable name="env-param" select="/root/env/param"/>
  56. <xsl:variable name="http-param" select="/root/http/param"/>
  57. <xsl:variable name="config-property" select="/root/configuration/property"/>
  58. <xsl:template match="/">
  59. <xts:sequence>
  60. <xts:append select="/root/output">
  61. <xsl:choose>
  62. <xsl:when test="/root/error">
  63. <xos:statusCode xmlns:xos="http://developer.cognos.com/schemas/xts/output/">404</xos:statusCode>
  64. </xsl:when>
  65. <xsl:otherwise>
  66. <!--
  67. NOTE: The CGI 1.1 interface does not describe the protocol scheme (ie. https) so the
  68. configuration gateway parameter's protocol scheme is used.
  69. Since multiple gateways may be used, the rest of the configuration gateway parameter
  70. is discarded and the URI is reconstructed from the incomming http parameters.
  71. -->
  72. <xsl:variable name="gateway" select="$config-property[@name = 'gateway']"/>
  73. <xsl:variable name="gateway-scheme">
  74. <xsl:if test="contains($gateway, '://')">
  75. <xsl:value-of select="substring-before($gateway, '://')"/>
  76. </xsl:if>
  77. </xsl:variable>
  78. <xsl:variable name="protocol">
  79. <xsl:choose>
  80. <xsl:when test="$gateway-scheme != ''">
  81. <xsl:value-of select="$gateway-scheme"/>
  82. </xsl:when>
  83. <xsl:otherwise>http</xsl:otherwise>
  84. </xsl:choose>
  85. </xsl:variable>
  86. <xsl:variable name="request-uri">
  87. <xsl:value-of select="concat($protocol, '://')"/>
  88. <xsl:value-of select="$http-param[@name = 'SERVER_NAME']"/>
  89. <xsl:if test="$http-param[@name = 'SERVER_PORT'] != '' and $http-param[@name = 'SERVER_PORT'] != '80'">
  90. <xsl:text>:</xsl:text>
  91. <xsl:value-of select="$http-param[@name = 'SERVER_PORT']"/>
  92. </xsl:if>
  93. <xsl:value-of select="$http-param[@name = 'SCRIPT_NAME']"/>
  94. <xsl:value-of select="$http-param[@name = 'PATH_INFO']"/>
  95. </xsl:variable>
  96. <xsl:variable name="resource" select="$env-param[@name = 'resourceType']"/>
  97. <xos:part xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
  98. <xos:entityHeader>
  99. <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
  100. </xos:entityHeader>
  101. <xos:entityBody>
  102. <xts:getResourceWSDL>
  103. <xts:param name="resourceType"><xsl:value-of select="$resource"/></xts:param>
  104. <xts:param name="servletURI"><xsl:value-of select="$request-uri"/></xts:param>
  105. <xts:param name="targetNamespace"><xsl:value-of select="concat('http://developer.cognos.com/nemo/', $resource)"/></xts:param>
  106. </xts:getResourceWSDL>
  107. </xos:entityBody>
  108. </xos:part>
  109. </xsl:otherwise>
  110. </xsl:choose>
  111. </xts:append>
  112. </xts:sequence>
  113. </xsl:template>
  114. </xsl:stylesheet>
  115. </xts:block>
  116. </xts:morphlet>