gethandler.xts 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cpscrn
  5. (C) Copyright IBM Corp. 2005, 2011
  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: //cps/main/src/cps/templates/cps2/gethandler.xts#4 $ -->
  13. <!-- $DateTime: 2003/12/10 15:46:32 $ -->
  14. <!-- $Change: 7283 $ -->
  15. <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  16. <xts:documentation>
  17. Web Service Discovery GET Handler
  18. modes:
  19. default - render list of services with urls to discover endpoints
  20. wsdl or WSDL - return wsdl xml document for referenced service
  21. notes:
  22. - because of restrictions on where the gethandler can be declared, this
  23. version will need to be aware of the implementation
  24. - if location is /cps2/producer, then we are handling the wsrp producer discovery
  25. - others should be handled as simple services.
  26. </xts:documentation>
  27. <xts:block id="get_interfaces" type="exec" processor="XSLT" mode="interpret">
  28. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  29. xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/"
  30. xmlns:cws="http://developer.cognos.com/schemas/xts/logicsheets/xslt/cws/"
  31. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  32. <xsl:template match="/">
  33. <xsl:for-each select="/root/interfaces/interfaceInfo[param[@name = 'virtualPath'] != '']">
  34. <xts:sequence>
  35. <xts:append>
  36. <xts:request protocol="FILEREAD" target="{ param[@name = 'location'] }/interface.xml" faultBlock="readfault"/>
  37. </xts:append>
  38. </xts:sequence>
  39. </xsl:for-each>
  40. </xsl:template>
  41. </xsl:stylesheet>
  42. </xts:block>
  43. <xts:block id="readfault" type="fault" processor="XSLT">
  44. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  45. <xsl:template match="/">
  46. <xsl:copy-of select="/error/*"/>
  47. </xsl:template>
  48. </xsl:stylesheet>
  49. </xts:block>
  50. <!--
  51. info
  52. if url is an interface endpoint
  53. if url is a wsrp endpoint
  54. if url is not a web service endpoint
  55. if there are multiple endpoints at one address
  56. render section for each web service
  57. render
  58. -->
  59. <xts:block id="info" dependency="get_interfaces" condition=".[not(/root/env/param[@name = 'wsdl'])]" mandatory="false" type="exec" processor="XSLT" mode="output" mimeType="text/html">
  60. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xts">
  61. <xsl:output method="html" omit-xml-declaration="yes" media-type="text/html" encoding="UTF-8"/>
  62. <xsl:template match="/">
  63. <html>
  64. <head>
  65. <title>Test Morphlet</title>
  66. <meta http-equiv="pragma" content="no-cache"/>
  67. <meta http-equiv="cache" content="0"/>
  68. </head>
  69. <body bgcolor="#ffffff">
  70. <h2>CPS Assembler</h2>
  71. <xsl:for-each select="/root/interface">
  72. <table cellpadding="2" cellspacing="0" border="1" width="50%">
  73. <tbody>
  74. <tr>
  75. <th>Param</th>
  76. <th>Value</th>
  77. </tr>
  78. <xsl:for-each select="operation">
  79. <tr>
  80. <td>
  81. <xsl:value-of select="@name"/>
  82. </td>
  83. <td>
  84. <xsl:value-of select="morphlet/@path"/>
  85. </td>
  86. </tr>
  87. </xsl:for-each>
  88. </tbody>
  89. </table>
  90. <br/>
  91. </xsl:for-each>
  92. <table cellpadding="2" cellspacing="0" border="1" width="50%">
  93. <tbody>
  94. <tr>
  95. <th>Param</th>
  96. <th>Value</th>
  97. </tr>
  98. <xsl:for-each select="/root/interfaces/interfaceInfo/param">
  99. <tr>
  100. <td>
  101. <xsl:value-of select="@name"/>
  102. </td>
  103. <td>
  104. <xsl:value-of select="."/>
  105. </td>
  106. </tr>
  107. </xsl:for-each>
  108. </tbody>
  109. </table>
  110. <br/>
  111. <xsl:call-template name="render-debug-links"/>
  112. </body>
  113. </html>
  114. </xsl:template>
  115. <xsl:template name="render-debug-links">
  116. <xsl:param name="trace" select="/root/debug/traceRequestPath"/>
  117. <xsl:param name="title"/>
  118. <xsl:if test="$trace">
  119. <xsl:variable name="server" select="/root/http/param[@name = 'HOST']"/>
  120. <xsl:variable name="traceurl" select="concat('http://', $server, '/cps/transerv?m=/debug/traceview.xts&amp;request=')"/>
  121. <xsl:variable name="sourceurl" select="concat($server, '?m=/debug/morphview.xts&amp;view=')"/>
  122. <xsl:variable name="source" select="substring-before($trace, '/execution-')"/>
  123. <xsl:variable name="instanceId" select="substring-after($trace, 'execution-')"/>
  124. <xsl:if test="$instanceId">
  125. <table cellspacing="0" cellpadding="0" border="0" width="100%" height="20">
  126. <tr>
  127. <td nowrap="nowrap" class="dialogHeaderLink" valign="top" align="right" width="100%">
  128. <a href="{ $sourceurl }{ $source }" target="morphsource_{ translate($source, '/.', '__') }">
  129. <xsl:value-of select="$source"/>
  130. </a>
  131. </td>
  132. <td valign="middle" width="5" height="20">
  133. <img width="5" height="20" src="/cps/debug/images/space.gif" alt=""/>
  134. </td>
  135. <td nowrap="nowrap" class="dialogHeaderLink" valign="top" align="right">
  136. <a href="{ $traceurl }{ $trace }" target="morphtrace_{ $instanceId }">trace</a>
  137. </td>
  138. </tr>
  139. </table>
  140. </xsl:if>
  141. </xsl:if>
  142. </xsl:template>
  143. </xsl:stylesheet>
  144. </xts:block>
  145. <!--
  146. request is for a wsrp producer endpoint
  147. load interface and handle wsrp namespace
  148. for first loaded interface
  149. load package info
  150. generate wsdl with only supported interfaces
  151. -->
  152. <xts:block id="wsdl" dependency="info" condition="/root/env/param[@name = 'wsdl']" mandatory="false" type="exec" processor="XSLT" mode="interpret">
  153. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  154. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  155. exclude-result-prefixes="xts">
  156. <xsl:template match="/">
  157. <xts:sequence>
  158. <xts:append select="/root">
  159. <schemas>
  160. <xsl:for-each select="/root/interface[1]/types/schema">
  161. <xts:request protocol="FILEREAD" target="{ @src }"/>
  162. </xsl:for-each>
  163. </schemas>
  164. </xts:append>
  165. <xts:append select="/root/output">
  166. <xts:transform processor="XSLT" src="/cps4/nav/wsdl/wsdl.xslt" option="part" mimeType="text/xml">
  167. <root>
  168. <xts:queryNode select="/root/interface[1] | /root/schemas | /root/http"/>
  169. </root>
  170. </xts:transform>
  171. </xts:append>
  172. </xts:sequence>
  173. </xsl:template>
  174. </xsl:stylesheet>
  175. </xts:block>
  176. </xts:morphlet>