serverContent.xts 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Copyright (C) 2008 Cognos Incorporated. All rights reserved.
  4. Cognos (R) is a trademark of Cognos Incorporated.
  5. -->
  6. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/">
  7. <xts:block id="dologin" type="exec" mode="interpret" processor="XSLT"
  8. xmlns:pf="http://developer.cognos.com/schemas/xts/pf" >
  9. <!-- This block requests NavigationTree from chosen TM1 server for the first time.
  10. This request is expected to fail with HTTP 302 (Found) and the same location as given.
  11. It also returns one to many cookies that are required in subsequent requests.
  12. -->
  13. <xts:logicsheet path="logicsheets/portal.xsl"/>
  14. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="xts xtsext xsl pf bus soapenv xsd xsi">
  15. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  16. <pf:variables/>
  17. <xsl:variable name="timeout" select="'200'"/>
  18. <xsl:template match="/">
  19. <xts:sequence>
  20. <xts:update select="/root/openNavTree1">
  21. <openNavTree1>
  22. <xts:request protocol="GET" faultBlock="handleNavTreeFault" protocolHeader="true" >
  23. <xsl:attribute name="href">
  24. <xsl:choose>
  25. <xsl:when test="key('env-param','https') and key('env-param','https') != '0' ">
  26. <xsl:text>https://</xsl:text>
  27. </xsl:when>
  28. <xsl:otherwise>
  29. <xsl:text>http://</xsl:text>
  30. </xsl:otherwise>
  31. </xsl:choose>
  32. <xsl:value-of select="key('env-param','TM1WebHost')"/>
  33. <xsl:text>:</xsl:text>
  34. <xsl:choose>
  35. <xsl:when test="key('env-param', 'TM1WebPort') != ''">
  36. <xsl:value-of select="key('env-param','TM1WebPort')"/>
  37. </xsl:when>
  38. <xsl:otherwise>
  39. <xsl:text>9510</xsl:text>
  40. </xsl:otherwise>
  41. </xsl:choose>
  42. <xsl:text>/</xsl:text>
  43. <xsl:value-of select="key('env-param','TM1WebVirtualDirectory')"/>
  44. <xsl:choose>
  45. <xsl:when test="key('env-param','TM1username') and key('env-param','TM1username') != '' ">
  46. <xsl:text>/services/TM1Service?method=loginServer</xsl:text>
  47. <xsl:text>&amp;userName=</xsl:text>
  48. <xsl:value-of select="key('env-param','TM1username')"/>
  49. <xsl:text>&amp;password=</xsl:text>
  50. <xsl:value-of select="key('env-param','TM1pass')"/>
  51. </xsl:when>
  52. <xsl:otherwise>
  53. <xsl:text>/services/TM1Service?method=loginServerCAM</xsl:text>
  54. <xsl:text>&amp;camPassport=</xsl:text>
  55. <xsl:value-of select="xtsext:urlencode($passport)"/>
  56. </xsl:otherwise>
  57. </xsl:choose>
  58. <xsl:text>&amp;serverName=</xsl:text>
  59. <xsl:value-of select="key('env-param','TM1DataServer')"/>
  60. <xsl:text>&amp;host=</xsl:text>
  61. <xsl:value-of select="key('env-param','TM1Host')"/>
  62. <xsl:text>&amp;decimalSep=.&amp;thousandSep=,</xsl:text>
  63. </xsl:attribute>
  64. <xsl:if test="$timeout">
  65. <xts:param name="timeout">
  66. <xsl:value-of select="number($timeout) * 1000 "/>
  67. </xts:param>
  68. </xsl:if>
  69. </xts:request>
  70. </openNavTree1>
  71. </xts:update>
  72. </xts:sequence>
  73. </xsl:template>
  74. </xsl:stylesheet>
  75. </xts:block>
  76. <xts:block id="transformNavTreeContent" type="exec" mode="interpret" dependency="dologin" processor="XSLT" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" mandatory="false">
  77. <xts:logicsheet path="logicsheets/portal.xsl"/>
  78. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="xts xtsext xsl pf bus xos xsd xsi soapenv">
  79. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  80. <pf:variables/>
  81. <xsl:template match="/root">
  82. <xts:sequence>
  83. <xts:append select="/root/output">
  84. <xts:transform processor="XSLT" src="/tm1/102GA/getServerTransform.xslt" option="part" mimeType="application/atom+xml">
  85. <xts:param name="messageBase">/messages/tm1buxmsgs.xml</xts:param>
  86. <root>
  87. <xsl:if test="key('env-param', 'Id') != ''">
  88. <Id>
  89. <xsl:value-of select="key('env-param','Id')"/>
  90. </Id>
  91. </xsl:if>
  92. <xsl:if test="key('env-param', 'TM1WebHost') != ''">
  93. <TM1WebURL>
  94. <xsl:choose>
  95. <xsl:when test="key('env-param','https') and key('env-param','https') != '0' ">
  96. <xsl:text>https://</xsl:text>
  97. </xsl:when>
  98. <xsl:otherwise>
  99. <xsl:text>http://</xsl:text>
  100. </xsl:otherwise>
  101. </xsl:choose>
  102. <xsl:value-of select="xtsext:urlencode(key('env-param','TM1WebHost'))"/>
  103. <xsl:text>:</xsl:text>
  104. <xsl:choose>
  105. <xsl:when test="key('env-param', 'TM1WebPort') != ''">
  106. <xsl:value-of select="key('env-param','TM1WebPort')"/>
  107. </xsl:when>
  108. <xsl:otherwise>
  109. <xsl:text>9510</xsl:text>
  110. </xsl:otherwise>
  111. </xsl:choose>
  112. </TM1WebURL>
  113. </xsl:if>
  114. <xsl:if test="key('env-param', 'TM1WebURL') != ''">
  115. <TM1WebURL>
  116. <xsl:value-of select="xtsext:urlencode(key('env-param','TM1WebURL'))"/>
  117. </TM1WebURL>
  118. </xsl:if>
  119. <xsl:if test="key('env-param', 'FilterPackages') != ''">
  120. <FilterPackages>
  121. <xsl:value-of select="xtsext:urlencode(key('env-param','FilterPackages'))"/>
  122. </FilterPackages>
  123. </xsl:if>
  124. <xsl:if test="key('env-param', 'TM1WebVirtualDirectory') != ''">
  125. <TM1WebVirtualDirectory>
  126. <xsl:value-of select="xtsext:urlencode(key('env-param','TM1WebVirtualDirectory'))"/>
  127. </TM1WebVirtualDirectory>
  128. </xsl:if>
  129. <xsl:if test="key('env-param', 'TM1Host') != ''">
  130. <TM1Host>
  131. <xsl:value-of select="key('env-param','TM1Host')"/>
  132. </TM1Host>
  133. </xsl:if>
  134. <xsl:if test="key('env-param', 'TM1DataServer') != ''">
  135. <TM1DataServer>
  136. <xsl:value-of select="xtsext:urlencode(key('env-param','TM1DataServer'))"/>
  137. </TM1DataServer>
  138. </xsl:if>
  139. <xsl:if test="key('env-param', 'NavTreeDisplayServerView') != ''">
  140. <TM1DisplayViews>
  141. <xsl:value-of select="xtsext:urlencode(key('env-param','NavTreeDisplayServerView'))"/>
  142. </TM1DisplayViews>
  143. </xsl:if>
  144. <xsl:if test="key('env-param', 'TM1username') != ''">
  145. <TM1username>
  146. <xsl:value-of select="key('env-param','TM1username')"/>
  147. </TM1username>
  148. </xsl:if>
  149. <xsl:if test="key('env-param', 'TM1pass') != ''">
  150. <TM1pass>
  151. <xsl:value-of select="key('env-param','TM1pass')"/>
  152. </TM1pass>
  153. </xsl:if>
  154. <xsl:if test="key('env-param', 'TM1Toolbar') != ''">
  155. <TM1Toolbar>
  156. <xsl:value-of select="key('env-param','TM1Toolbar')"/>
  157. </TM1Toolbar>
  158. </xsl:if>
  159. <xsl:if test="key('env-param', 'ASPSessionId') != ''">
  160. <JSESSIONID>
  161. <xsl:value-of select="key('env-param','JSESSIONID')"/>
  162. </JSESSIONID>
  163. </xsl:if>
  164. <!-- Here's where the cookies get sent -->
  165. <xsl:for-each select="/root/openNavTree1/xos:protocolHeader/xos:param[@name='Set-Cookie']">
  166. <!-- For each cookie returned in previous request -->
  167. <JSESSIONID>
  168. <xsl:value-of select="xtsext:urlencode(text())"/>
  169. </JSESSIONID>
  170. </xsl:for-each>
  171. <GatewayURL>
  172. <xsl:value-of select="$gateway"/>
  173. </GatewayURL>
  174. <WebRootURL>
  175. <xsl:value-of select="$webRoot"/>
  176. </WebRootURL>
  177. <TM1pass2>
  178. <xsl:text>id0</xsl:text>
  179. </TM1pass2>
  180. <xsl:copy-of select="/root/openNavTree1/soapenv:Envelope/soapenv:Body/loginServerCAMResponse"/>
  181. <xsl:copy-of select="/root/openNavTree1/soapenv:Envelope/soapenv:Body/loginServerResponse"/>
  182. </root>
  183. </xts:transform>
  184. </xts:append>
  185. </xts:sequence>
  186. </xsl:template>
  187. </xsl:stylesheet>
  188. </xts:block>
  189. <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
  190. <xts:block id="handleNavTreeFault" type="fault" processor="XSLT">
  191. <xsl:stylesheet version="1.0"
  192. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  193. xmlns:xtse="http://developer.cognos.com/schemas/xts/error/1/">
  194. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  195. <xsl:template match="/">
  196. <xtse:error>
  197. <xsl:for-each select="/root/fault/xts:exception[not(starts-with(xts:exceptionCode, 'java'))]">
  198. <xtse:message>
  199. <xsl:value-of select="xts:exceptionMsg"/>
  200. </xtse:message>
  201. <xtse:detail>
  202. <xsl:for-each select="xts:exceptionDetail">
  203. <xsl:call-template name="copyTree"/>
  204. </xsl:for-each>
  205. </xtse:detail>
  206. </xsl:for-each>
  207. </xtse:error>
  208. </xsl:template>
  209. <xsl:template name="copyTree">
  210. <xsl:param name="nodes" select="."/>
  211. <xsl:for-each select="$nodes">
  212. <xsl:copy>
  213. <xsl:for-each select="@*">
  214. <xsl:copy/>
  215. </xsl:for-each>
  216. <xsl:call-template name="copyTree">
  217. <xsl:with-param name="nodes" select="*|text()|comment()"/>
  218. </xsl:call-template>
  219. </xsl:copy>
  220. </xsl:for-each>
  221. </xsl:template>
  222. </xsl:stylesheet>
  223. </xts:block>
  224. </xts:morphlet>