VirtualBox

source: vbox/trunk/src/VBox/Main/webservice/websrv-wsdl.xsl@ 84347

Last change on this file since 84347 was 82974, checked in by vboxsync, 5 years ago

Copyright year updates - manual ones.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 62.6 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4
5 websrv-wsdl.xsl:
6 XSLT stylesheet that generates vboxweb.wsdl from
7 VirtualBox.xidl. This WSDL file represents our
8 web service API..
9 See webservice/Makefile.kmk for an overview of all the things
10 generated for the webservice.
11
12 Copyright (C) 2006-2020 Oracle Corporation
13
14 This file is part of VirtualBox Open Source Edition (OSE), as
15 available from http://www.virtualbox.org. This file is free software;
16 you can redistribute it and/or modify it under the terms of the GNU
17 General Public License (GPL) as published by the Free Software
18 Foundation, in version 2 as it comes in the "COPYING" file of the
19 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
20 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
21-->
22
23<!--
24 A WSDL document describes a web service using these major elements:
25 Element Defines
26 <types> The data types used by the web service, described in XML Schema
27 syntax.
28 <message> The messages used by the web service. A message is a function call
29 and with it come "parts", which are the parameters.
30 <portType> The operations performed by the web service. A portType can be thought
31 of as a class or, in COM terms, as an interface.
32 <binding> The communication protocols used by the web service.
33
34 The root tag is <definitions>.
35
36 Representing COM interfaces is tricky in WSDL 1.1, which doesn't really have them.
37 WSDL only knows about "port types", which are an abstract representation
38 of a group of functions. So for each "interface", we need to emit
39 a "port type"; in the port type, we declare each "interface method"
40 as one "operation". Each operation in turn consists of at least one
41 message for the method invocation, which contains all the "in" and
42 "inout" arguments. An optional second message for the response contains
43 the return value, if one is present in the IDL (called "_return" to
44 avoid name clashes), together with all the "out" and "inout" arguments.
45 Each of these messages, however, need to be independently declared
46 using the "message" element outside of the "port type" declaration.
47
48 As an example: To create this XPCOM IDL:
49
50 void createMachine (
51 in wstring baseFolder,
52 in wstring name,
53 [retval] out IMachine machine
54 );
55
56 the following exists in the XIDL:
57
58 <interface name="ifname">
59 <method name="createMachine">
60 <param name="baseFolder" type="wstring" dir="in" />
61 <param name="name" type="wstring" dir="in" />
62 <param name="machine" type="IMachine" dir="return" />
63 </method>
64 </interface>
65
66 So, we have two "in" parameters, and one "out" parameter. The
67 operation therefore requires two messages (one for the request,
68 with the two "in" parameters, and one for the result with the
69 return value). With RPC/encoded style, we end up with this:
70
71 <message name="ifname.methodname_Request">
72 <part name="baseFolder" type="xsd:string" />
73 <part name="name" type="xsd:string" />
74 </message>
75 <message name="ifname.methodname_Result">
76 <part name="_return" type="IMachine" />
77 </message>
78 <portType name="ifname">
79 <operation name="methodname"
80 <input message="ifname.methodname_Request" />
81 <output message="ifname.methodname_Result" />
82 </operation>
83 </portType>
84
85 With document/literal style, things get even more verbose, as
86 instead of listing the arguments and return values in the messages,
87 we declare a struct-like complexType in the <types> section
88 instead and then reference that type in the messages.
89-->
90
91<xsl:stylesheet
92 version="1.0"
93 targetNamespace="http://schemas.xmlsoap.org/wsdl/"
94 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
95 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
96 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
97 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
98 xmlns:vbox="http://www.virtualbox.org/"
99 xmlns:exsl="http://exslt.org/common"
100 extension-element-prefixes="exsl">
101
102<xsl:param name="G_argDebug" />
103
104<xsl:output
105 method="xml"
106 version="1.0"
107 encoding="utf-8"
108 indent="yes"/>
109
110<xsl:strip-space
111 elements="*" />
112
113<!--**********************************************************************
114 *
115 * global XSLT variables
116 *
117 **********************************************************************-->
118
119<xsl:variable name="G_xsltFilename" select="'websrv-wsdl.xsl'" />
120
121<xsl:include href="../idl/typemap-shared.inc.xsl" />
122
123<!-- collect all interfaces with "wsmap='suppress'" in a global variable for
124 quick lookup -->
125<xsl:variable name="G_setSuppressedInterfaces"
126 select="//interface[@wsmap='suppress']" />
127
128<!-- this marker is used with WSDL document style to mark that a message
129 should have an automatic type that matches a complexType definition;
130 use a string that cannot possibly appear in an XIDL interface name -->
131<xsl:variable name="G_typeIsGlobalRequestElementMarker"
132 select="'&lt;&lt;&lt;&lt;Request'" />
133<xsl:variable name="G_typeIsGlobalResponseElementMarker"
134 select="'&lt;&lt;&lt;&lt;Response'" />
135
136<!-- - - - - - - - - - - - - - - - - - - - - - -
137 Keys for more efficiently looking up of types.
138 - - - - - - - - - - - - - - - - - - - - - - -->
139
140<xsl:key name="G_keyEnumsByName" match="//enum[@name]" use="@name"/>
141<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
142
143
144<!--**********************************************************************
145 *
146 * shared helpers
147 *
148 **********************************************************************-->
149
150<!--
151 function emitConvertedType
152 -->
153<xsl:template name="emitConvertedType">
154 <xsl:param name="ifname" />
155 <xsl:param name="methodname" />
156 <xsl:param name="type" />
157 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('......emitConvertedType: type=&quot;', $type, '&quot;')" /></xsl:call-template>
158 <!-- look up XML Schema type from IDL type from table array in typemap-shared.inc.xsl -->
159 <xsl:variable name="xmltypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@xmlname" />
160 <xsl:choose>
161 <xsl:when test="$type=$G_typeIsGlobalRequestElementMarker"><xsl:value-of select="concat('vbox:', $ifname, $G_classSeparator, $methodname, $G_requestMessageElementSuffix)" /></xsl:when>
162 <xsl:when test="$type=$G_typeIsGlobalResponseElementMarker"><xsl:value-of select="concat('vbox:', $ifname, $G_classSeparator, $methodname, $G_responseMessageElementSuffix)" /></xsl:when>
163 <!-- if above lookup in table succeeded, use that type -->
164 <xsl:when test="string-length($xmltypefield)"><xsl:value-of select="concat('xsd:', $xmltypefield)" /></xsl:when>
165 <xsl:when test="$type='$unknown'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
166 <xsl:when test="$type='global'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
167 <xsl:when test="$type='managed'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
168 <xsl:when test="$type='explicit'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
169 <!-- enums are easy, these are defined in schema at the top of the wsdl -->
170 <xsl:when test="count(key('G_keyEnumsByName', $type)) > 0"><xsl:value-of select="concat('vbox:', $type)" /></xsl:when>
171 <!-- otherwise test for an interface with this name -->
172 <xsl:when test="count(key('G_keyInterfacesByName', $type)) > 0">
173 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
174 <xsl:variable name="wsmap" select="key('G_keyInterfacesByName', $type)/@wsmap" />
175 <xsl:choose>
176 <xsl:when test="$wsmap='struct'"><xsl:value-of select="concat('vbox:', $type)" /></xsl:when>
177 <xsl:when test="$wsmap='global'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
178 <xsl:when test="$wsmap='managed'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
179 <xsl:when test="$wsmap='explicit'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
180 <xsl:when test="$wsmap='suppress'">
181 <xsl:call-template name="fatalError">
182 <xsl:with-param name="msg" select="concat('emitConvertedType: Type &quot;', $type, '&quot; in method &quot;', $ifname, '::', $methodname, '&quot; has wsmap=&quot;suppress&quot; attribute in XIDL. This function should have been suppressed as well.')" />
183 </xsl:call-template>
184 </xsl:when>
185 <xsl:otherwise>
186 <xsl:call-template name="fatalError">
187 <xsl:with-param name="msg" select="concat('emitConvertedType: Type &quot;', $type, '&quot; used in method &quot;', $ifname, '::', $methodname, '&quot; has unsupported wsmap attribute value &quot;', $wsmap, '&quot;')" />
188 </xsl:call-template>
189 </xsl:otherwise>
190 </xsl:choose>
191 </xsl:when>
192 <xsl:otherwise>
193 <xsl:call-template name="fatalError">
194 <xsl:with-param name="msg" select="concat('emitConvertedType: Unknown type &quot;', $type, '&quot; used in method &quot;', $ifname, '::', $methodname, '&quot;.')" />
195 </xsl:call-template>
196 </xsl:otherwise>
197 </xsl:choose>
198</xsl:template>
199
200<!--
201 function convertTypeAndEmitPartOrElement
202 -->
203<xsl:template name="convertTypeAndEmitPartOrElement">
204 <xsl:param name="ifname" />
205 <xsl:param name="methodname" />
206 <xsl:param name="name" />
207 <xsl:param name="type" />
208 <xsl:param name="safearray" /> <!-- "yes" if XIDL has safearray=yes -->
209 <xsl:param name="elname" /> <!-- "part" or "element" -->
210 <xsl:param name="attrname" /> <!-- attrib of part or element: <part type=...> or <part element=...> or <element type=...> -->
211
212 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('....convertTypeAndEmitPartOrElement: arg name: ', $name)" /></xsl:call-template>
213 <xsl:choose>
214 <xsl:when test="$safearray='yes' and $type='octet'">
215 <!-- we pass octet arrays as Base64-encoded strings. -->
216 <xsl:element name="{$elname}">
217 <xsl:attribute name="name"><xsl:value-of select="$name" /></xsl:attribute>
218 <xsl:attribute name="type"><xsl:value-of select="'xsd:string'" /></xsl:attribute>
219 </xsl:element>
220 </xsl:when>
221
222 <xsl:when test="$safearray='yes'">
223 <xsl:element name="{$elname}"> <!-- <part> or <element> -->
224 <xsl:attribute name="name"><xsl:value-of select="$name" /></xsl:attribute>
225 <xsl:attribute name="minOccurs"><xsl:value-of select="'0'" /></xsl:attribute>
226 <xsl:attribute name="maxOccurs"><xsl:value-of select="'unbounded'" /></xsl:attribute>
227 <xsl:attribute name="{$attrname}">
228 <xsl:call-template name="emitConvertedType">
229 <xsl:with-param name="ifname" select="$ifname" />
230 <xsl:with-param name="methodname" select="$methodname" />
231 <xsl:with-param name="type" select="$type" />
232 </xsl:call-template>
233 </xsl:attribute>
234 </xsl:element>
235 </xsl:when>
236 <xsl:otherwise>
237 <xsl:element name="{$elname}"> <!-- <part> or <element> -->
238 <xsl:attribute name="name"><xsl:value-of select="$name" /></xsl:attribute>
239 <xsl:attribute name="{$attrname}">
240 <xsl:call-template name="emitConvertedType">
241 <xsl:with-param name="ifname" select="$ifname" />
242 <xsl:with-param name="methodname" select="$methodname" />
243 <xsl:with-param name="type" select="$type" />
244 </xsl:call-template>
245 </xsl:attribute>
246 </xsl:element>
247 </xsl:otherwise>
248 </xsl:choose>
249</xsl:template>
250
251<!--
252 function emitRequestArgs
253 -->
254<xsl:template name="emitRequestArgs">
255 <xsl:param name="_ifname" /> <!-- interface name -->
256 <xsl:param name="_wsmap" /> <!-- interface's wsmap attribute -->
257 <xsl:param name="_methodname" />
258 <xsl:param name="_params" />
259 <xsl:param name="_valuetype" /> <!-- optional, for attribute setter messages -->
260 <xsl:param name="_valuesafearray" /> <!-- optional, 'yes' if attribute of setter has safearray=yes -->
261 <xsl:param name="_elname" /> <!-- "part" or "xsd:element" -->
262 <xsl:param name="_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
263
264 <!-- first parameter will be object on which method is called, depending on wsmap attribute -->
265 <xsl:choose>
266 <xsl:when test="($_wsmap='managed') or ($_wsmap='explicit')">
267 <xsl:call-template name="convertTypeAndEmitPartOrElement">
268 <xsl:with-param name="ifname" select="$_ifname" />
269 <xsl:with-param name="methodname" select="$_methodname" />
270 <xsl:with-param name="name" select="$G_nameObjectRef" />
271 <xsl:with-param name="type" select="$_wsmap" />
272 <xsl:with-param name="safearray" select="'no'" />
273 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
274 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
275 </xsl:call-template>
276 </xsl:when>
277 </xsl:choose>
278 <!-- now for the real parameters, if any -->
279 <xsl:for-each select="$_params">
280 <!-- emit only parts for "in" parameters -->
281 <xsl:if test="@dir='in'">
282 <xsl:call-template name="convertTypeAndEmitPartOrElement">
283 <xsl:with-param name="ifname" select="$_ifname" />
284 <xsl:with-param name="methodname" select="$_methodname" />
285 <xsl:with-param name="name" select="@name" />
286 <xsl:with-param name="type" select="@type" />
287 <xsl:with-param name="safearray" select="@safearray" />
288 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
289 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
290 </xsl:call-template>
291 </xsl:if>
292 </xsl:for-each>
293 <xsl:if test="$_valuetype">
294 <!-- <part>
295 <xsl:attribute name="name">value</xsl:attribute>
296 <xsl:attribute name="type"><xsl:value-of select='string($_valuetype)' /></xsl:attribute>
297 </part> -->
298 <xsl:call-template name="convertTypeAndEmitPartOrElement">
299 <xsl:with-param name="ifname" select="$_ifname" />
300 <xsl:with-param name="methodname" select="$_methodname" />
301 <xsl:with-param name="name" select="@name" />
302 <xsl:with-param name="type" select="@type" />
303 <xsl:with-param name="safearray" select="@safearray" />
304 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
305 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
306 </xsl:call-template>
307 </xsl:if>
308</xsl:template>
309
310<!--
311 function emitResultArgs
312 -->
313<xsl:template name="emitResultArgs">
314 <xsl:param name="_ifname" />
315 <xsl:param name="_methodname" />
316 <xsl:param name="_params" /> <!-- set of parameter elements -->
317 <xsl:param name="_resulttype" /> <!-- for attribute getter methods only -->
318 <xsl:param name="_resultsafearray" /> <!-- for attribute getter methods only -->
319 <xsl:param name="_elname" /> <!-- "part" or "xsd:element" -->
320 <xsl:param name="_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
321
322 <xsl:choose>
323 <xsl:when test="$_resulttype">
324 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $_ifname, '::', $_methodname, ': ', 'resultmsg for attr of type ', $_resulttype)" /></xsl:call-template>
325 <xsl:call-template name="convertTypeAndEmitPartOrElement">
326 <xsl:with-param name="ifname" select="$_ifname" />
327 <xsl:with-param name="methodname" select="$_methodname" />
328 <xsl:with-param name="name" select="$G_result" />
329 <xsl:with-param name="type" select="$_resulttype" />
330 <xsl:with-param name="safearray" select="$_resultsafearray" />
331 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
332 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
333 </xsl:call-template>
334 </xsl:when>
335 <xsl:otherwise>
336 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', 'resultmsg for method: ', $_ifname, '::', $_methodname)" /></xsl:call-template>
337 <xsl:for-each select="$_params">
338 <!-- emit only parts for "out" parameters -->
339 <xsl:if test="@dir='out'">
340 <xsl:call-template name="convertTypeAndEmitPartOrElement">
341 <xsl:with-param name="ifname" select="$_ifname" />
342 <xsl:with-param name="methodname" select="$_methodname" />
343 <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
344 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
345 <xsl:with-param name="safearray" select="@safearray" />
346 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
347 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
348 </xsl:call-template>
349 </xsl:if>
350 <xsl:if test="@dir='return'">
351 <xsl:call-template name="convertTypeAndEmitPartOrElement">
352 <xsl:with-param name="ifname" select="$_ifname" />
353 <xsl:with-param name="methodname" select="$_methodname" />
354 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
355 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
356 <xsl:with-param name="safearray" select="@safearray" />
357 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
358 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
359 </xsl:call-template>
360 </xsl:if>
361 </xsl:for-each>
362 </xsl:otherwise>
363 </xsl:choose>
364</xsl:template>
365
366<!--
367 function emitRequestElements:
368 for "in" parameters
369 -->
370<xsl:template name="emitRequestElements">
371 <xsl:param name="_ifname" /> <!-- interface name -->
372 <xsl:param name="_wsmap" /> <!-- interface's wsmap attribute -->
373 <xsl:param name="_methodname" />
374 <xsl:param name="_params" />
375 <xsl:param name="_valuetype" /> <!-- optional, for attribute setter messages -->
376 <xsl:param name="_valuesafearray" /> <!-- optional, 'yes' if attribute of setter has safearray=yes -->
377
378 <xsd:element>
379 <xsl:attribute name="name"><xsl:value-of select="concat($_ifname, $G_classSeparator, $_methodname, $G_requestMessageElementSuffix)" /></xsl:attribute>
380 <xsd:complexType>
381 <xsd:sequence>
382 <xsl:call-template name="emitRequestArgs">
383 <xsl:with-param name="_ifname" select="$_ifname" /> <!-- interface name -->
384 <xsl:with-param name="_wsmap" select="$_wsmap" /> <!-- interface's wsmap attribute -->
385 <xsl:with-param name="_methodname" select="$_methodname" />
386 <xsl:with-param name="_params" select="$_params" />
387 <xsl:with-param name="_valuetype" select="$_valuetype" /> <!-- optional, for attribute setter messages -->
388 <xsl:with-param name="_valuesafearray" select="$_valuesafearray" /> <!-- optional, for attribute setter messages -->
389 <xsl:with-param name="_elname" select="'xsd:element'" /> <!-- "part" or "xsd:element" -->
390 <xsl:with-param name="_attrname" select="'type'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
391 </xsl:call-template>
392 </xsd:sequence>
393 </xsd:complexType>
394 </xsd:element>
395</xsl:template>
396
397<!--
398 function emitResultElements:
399 for "out" and "return" parameters
400 -->
401<xsl:template name="emitResultElements">
402 <xsl:param name="_ifname" />
403 <xsl:param name="_methodname" />
404 <xsl:param name="_params" /> <!-- set of parameter elements -->
405 <xsl:param name="_resulttype" /> <!-- optional, for attribute getter methods only -->
406 <xsl:param name="_resultsafearray" /> <!-- optional, 'yes' if attribute of getter has safearray=yes -->
407
408 <xsd:element>
409 <xsl:attribute name="name"><xsl:value-of select="concat($_ifname, $G_classSeparator, $_methodname, $G_responseMessageElementSuffix)" /></xsl:attribute>
410 <xsd:complexType>
411 <xsd:sequence>
412 <xsl:call-template name="emitResultArgs">
413 <xsl:with-param name="_ifname" select="$_ifname" />
414 <xsl:with-param name="_methodname" select="$_methodname" />
415 <xsl:with-param name="_params" select="$_params" /> <!-- set of parameter elements -->
416 <xsl:with-param name="_resulttype" select="$_resulttype" /> <!-- for attribute getter methods only -->
417 <xsl:with-param name="_resultsafearray" select="$_resultsafearray" /> <!-- for attribute getter methods only -->
418 <xsl:with-param name="_elname" select="'xsd:element'" /> <!-- "part" or "xsd:element" -->
419 <xsl:with-param name="_attrname" select="'type'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
420 </xsl:call-template>
421 </xsd:sequence>
422 </xsd:complexType>
423 </xsd:element>
424</xsl:template>
425
426<!--
427 function emitGetAttributeElements
428 -->
429<xsl:template name="emitGetAttributeElements">
430 <xsl:param name="ifname" />
431 <xsl:param name="wsmap" />
432 <xsl:param name="attrname" />
433 <xsl:param name="attrtype" />
434 <xsl:param name="attrsafearray" />
435
436 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
437 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $ifname, '::', $attrGetter)" /></xsl:call-template>
438 <xsl:call-template name="emitRequestElements">
439 <xsl:with-param name="_ifname" select="$ifname" />
440 <xsl:with-param name="_wsmap" select="$wsmap" />
441 <xsl:with-param name="_methodname" select="$attrGetter" />
442 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
443 </xsl:call-template>
444 <xsl:call-template name="emitResultElements">
445 <xsl:with-param name="_ifname" select="$ifname" />
446 <xsl:with-param name="_methodname" select="$attrGetter" />
447 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
448 <xsl:with-param name="_resulttype" select='$attrtype' />
449 <xsl:with-param name="_resultsafearray" select='$attrsafearray' />
450 </xsl:call-template>
451</xsl:template>
452
453<!--
454 function: emitRequestMessage
455 for "in" parameters
456-->
457<xsl:template name="emitRequestMessage">
458 <xsl:param name="_ifname" /> <!-- interface name -->
459 <xsl:param name="_wsmap" /> <!-- interface's wsmap attribute -->
460 <xsl:param name="_methodname" />
461 <xsl:param name="_params" />
462 <xsl:param name="_valuetype" /> <!-- optional, for attribute setter messages -->
463
464 <wsdl:message>
465 <xsl:attribute name="name"><xsl:value-of select="concat($_ifname, $G_classSeparator, $_methodname, $G_methodRequest)" /></xsl:attribute>
466
467 <xsl:call-template name="convertTypeAndEmitPartOrElement">
468 <xsl:with-param name="ifname" select="$_ifname" />
469 <xsl:with-param name="methodname" select="$_methodname" />
470 <xsl:with-param name="name" select="'parameters'" />
471 <xsl:with-param name="type" select="$G_typeIsGlobalRequestElementMarker" />
472 <xsl:with-param name="safearray" select="'no'" />
473 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
474 <xsl:with-param name="attrname" select="'element'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
475 </xsl:call-template>
476 </wsdl:message>
477</xsl:template>
478
479<!--
480 function: emitResultMessage
481 for "out" and "return" parameters
482-->
483<xsl:template name="emitResultMessage">
484 <xsl:param name="_ifname" />
485 <xsl:param name="_methodname" />
486 <xsl:param name="_params" /> <!-- set of parameter elements -->
487 <xsl:param name="_resulttype" /> <!-- for attribute getter methods only -->
488
489 <wsdl:message>
490 <xsl:attribute name="name"><xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodResponse" /></xsl:attribute>
491
492 <!-- <xsl:variable name="cOutParams" select="count($_params[@dir='out']) + count($_params[@dir='return'])" /> -->
493 <xsl:call-template name="convertTypeAndEmitPartOrElement">
494 <xsl:with-param name="ifname" select="$_ifname" />
495 <xsl:with-param name="methodname" select="$_methodname" />
496 <xsl:with-param name="name" select="'parameters'" />
497 <xsl:with-param name="type" select="$G_typeIsGlobalResponseElementMarker" />
498 <xsl:with-param name="safearray" select="'no'" />
499 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
500 <xsl:with-param name="attrname" select="'element'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
501 </xsl:call-template>
502 </wsdl:message>
503</xsl:template>
504
505<!--
506 function emitGetAttributeMessages:
507-->
508<xsl:template name="emitGetAttributeMessages">
509 <xsl:param name="ifname" />
510 <xsl:param name="wsmap" />
511 <xsl:param name="attrname" />
512 <xsl:param name="attrtype" />
513
514 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
515 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $ifname, '::', $attrGetter)" /></xsl:call-template>
516 <xsl:call-template name="emitRequestMessage">
517 <xsl:with-param name="_ifname" select="$ifname" />
518 <xsl:with-param name="_wsmap" select="$wsmap" />
519 <xsl:with-param name="_methodname" select="$attrGetter" />
520 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
521 </xsl:call-template>
522 <xsl:call-template name="emitResultMessage">
523 <xsl:with-param name="_ifname" select="$ifname" />
524 <xsl:with-param name="_methodname" select="$attrGetter" />
525 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
526 <xsl:with-param name="_resulttype" select='$attrtype' />
527 </xsl:call-template>
528</xsl:template>
529
530<!--
531 function emitSetAttributeMessages
532 -->
533<xsl:template name="emitSetAttributeMessages">
534 <xsl:param name="ifname" select="$ifname" />
535 <xsl:param name="wsmap" select="$wsmap" />
536 <xsl:param name="attrname" select="$attrname" />
537 <xsl:param name="attrtype" select="$attrtype" />
538
539 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
540 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $ifname, '::', $attrSetter)" /></xsl:call-template>
541 <xsl:call-template name="emitRequestMessage">
542 <xsl:with-param name="_ifname" select="$ifname" />
543 <xsl:with-param name="_wsmap" select="$wsmap" />
544 <xsl:with-param name="_methodname" select="$attrSetter" />
545 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
546 <xsl:with-param name="_valuetype" select="$attrtype" />
547 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
548 </xsl:call-template>
549 <xsl:call-template name="emitResultMessage">
550 <xsl:with-param name="_ifname" select="$ifname" />
551 <xsl:with-param name="_methodname" select="$attrSetter" />
552 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
553 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
554 </xsl:call-template>
555</xsl:template>
556
557<!--
558 function emitInOutOperation:
559 referencing the messages that must have been emitted previously
560-->
561<xsl:template name="emitInOutOperation">
562 <xsl:param name="_ifname" /> <!-- interface name -->
563 <xsl:param name="_methodname" /> <!-- method name -->
564 <xsl:param name="_params" />
565 <xsl:param name="_resulttype" /> <!-- for attribute getter methods only -->
566 <xsl:param name="_fSoap" />
567
568 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('....emitInOutOperation ', $_ifname, '::', $_methodname)" /></xsl:call-template>
569
570 <wsdl:operation>
571 <xsl:attribute name="name">
572 <xsl:value-of select="concat($_ifname, '_', $_methodname)" />
573 </xsl:attribute>
574 <xsl:if test="$_fSoap">
575 <soap:operation>
576 <!-- VMware has an empty attribute like this as well -->
577 <xsl:attribute name="soapAction"><xsl:value-of select="''" /></xsl:attribute>
578 <xsl:attribute name="style"><xsl:value-of select="$G_basefmt" /></xsl:attribute>
579 </soap:operation>
580 </xsl:if>
581 <wsdl:input>
582 <xsl:choose>
583 <xsl:when test="$_fSoap">
584 <soap:body>
585 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
586 <!-- avoid jax-ws warning: <xsl:attribute name="namespace"><xsl:value-of select="concat($G_targetNamespace, $G_targetNamespaceSeparator)" /></xsl:attribute>-->
587 </soap:body>
588 </xsl:when>
589 <xsl:otherwise>
590 <xsl:attribute name="message">vbox:<xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodRequest" /></xsl:attribute>
591 </xsl:otherwise>
592 </xsl:choose>
593 </wsdl:input>
594 <xsl:choose>
595 <xsl:when test="$_resulttype">
596 <wsdl:output>
597 <xsl:choose>
598 <xsl:when test="$_fSoap">
599 <soap:body>
600 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
601 <!-- avoid jax-ws warning: <xsl:attribute name="namespace"><xsl:value-of select="concat($G_targetNamespace, $G_targetNamespaceSeparator)" /></xsl:attribute> -->
602 </soap:body>
603 </xsl:when>
604 <xsl:otherwise>
605 <xsl:attribute name="message">vbox:<xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodResponse" /></xsl:attribute>
606 </xsl:otherwise>
607 </xsl:choose>
608 </wsdl:output>
609 </xsl:when>
610 <xsl:otherwise>
611 <!-- <xsl:if test="count($_params[@dir='out'] | $_params[@dir='return']) > 0"> -->
612 <wsdl:output>
613 <xsl:choose>
614 <xsl:when test="$_fSoap">
615 <soap:body>
616 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
617 <!-- avoid jax-ws warning: <xsl:attribute name="namespace"><xsl:value-of select="concat($G_targetNamespace, $G_targetNamespaceSeparator)" /></xsl:attribute> -->
618 </soap:body>
619 </xsl:when>
620 <xsl:otherwise>
621 <xsl:attribute name="message">vbox:<xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodResponse" /></xsl:attribute>
622 </xsl:otherwise>
623 </xsl:choose>
624 </wsdl:output>
625 <!-- </xsl:if> -->
626 </xsl:otherwise>
627 </xsl:choose>
628 <xsl:choose>
629 <xsl:when test="not($_fSoap)">
630 <wsdl:fault name="InvalidObjectFault" message="vbox:InvalidObjectFaultMsg" />
631 <wsdl:fault name="RuntimeFault" message="vbox:RuntimeFaultMsg" />
632 </xsl:when>
633 <xsl:otherwise>
634 <wsdl:fault name="InvalidObjectFault">
635 <soap:fault name="InvalidObjectFault">
636 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
637 </soap:fault>
638 </wsdl:fault>
639 <wsdl:fault name="RuntimeFault">
640 <soap:fault name="RuntimeFault">
641 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
642 </soap:fault>
643 </wsdl:fault>
644 </xsl:otherwise>
645 </xsl:choose>
646 </wsdl:operation>
647</xsl:template>
648
649<!--
650 function verifyInterface
651-->
652<xsl:template name="verifyInterface">
653 <xsl:param name="ifname" />
654 <xsl:param name="wsmap" />
655
656 <xsl:choose>
657 <xsl:when test="$wsmap='global'" />
658 <xsl:when test="$wsmap='managed'" />
659 <xsl:when test="$wsmap='explicit'" />
660 <xsl:when test="$wsmap='struct'" />
661 <xsl:when test="$wsmap='suppress'" />
662 <xsl:otherwise>
663 <xsl:call-template name="fatalError">
664 <xsl:with-param name="msg" select="concat(local-name(), ' template: Interface &quot;', $ifname, '&quot; has invalid wsmap attribute &quot;', $wsmap, '&quot; in XIDL.')" />
665 </xsl:call-template>
666 </xsl:otherwise>
667 </xsl:choose>
668
669 <!-- now make sure we have each interface only once -->
670 <xsl:if test="(count(//library/interface[@name=$ifname]) > 1)">
671 <xsl:call-template name="fatalError">
672 <xsl:with-param name="msg" select="concat(local-name(), ' template: There is more than one interface with a name=&quot;', $ifname, '&quot; attribute.')" />
673 </xsl:call-template>
674 </xsl:if>
675</xsl:template>
676
677<!--
678 function emitMessagesForInterface
679-->
680<xsl:template name="emitMessagesForInterface">
681 <xsl:param name="ifname" />
682 <xsl:param name="wsmap" />
683
684 <!-- 1) outside the portType, here come the in/out methods for all the "operations" we declare below;
685 a) for attributes (get/set methods)
686 b) for "real" methods
687 -->
688 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('************* messages for interface &quot;', $ifname, '&quot;')" /></xsl:call-template>
689 <!-- a) attributes first -->
690 <xsl:for-each select="attribute">
691 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
692 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
693 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
694 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('messages for ', $ifname, '::', $attrname, ': attribute of type &quot;', $attrtype, '&quot;, readonly: ', $attrreadonly)" /></xsl:call-template>
695 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
696 <xsl:choose>
697 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
698 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is of a suppressed type')" /></xsl:comment>
699 </xsl:when>
700 <xsl:when test="@wsmap = 'suppress'">
701 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is suppressed')" /></xsl:comment>
702 </xsl:when>
703 <xsl:otherwise>
704 <xsl:choose>
705 <xsl:when test="@readonly='yes'">
706 <xsl:comment> readonly attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
707 </xsl:when>
708 <xsl:otherwise>
709 <xsl:comment> read/write attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
710 </xsl:otherwise>
711 </xsl:choose>
712 <!-- aa) get method: emit request and result -->
713 <xsl:call-template name="emitGetAttributeMessages">
714 <xsl:with-param name="ifname" select="$ifname" />
715 <xsl:with-param name="wsmap" select="$wsmap" />
716 <xsl:with-param name="attrname" select="$attrname" />
717 <xsl:with-param name="attrtype" select="$attrtype" />
718 </xsl:call-template>
719 <!-- bb) emit a set method if the attribute is read/write -->
720 <xsl:if test="not($attrreadonly='yes')">
721 <xsl:call-template name="emitSetAttributeMessages">
722 <xsl:with-param name="ifname" select="$ifname" />
723 <xsl:with-param name="wsmap" select="$wsmap" />
724 <xsl:with-param name="attrname" select="$attrname" />
725 <xsl:with-param name="attrtype" select="$attrtype" />
726 </xsl:call-template>
727 </xsl:if>
728 </xsl:otherwise>
729 </xsl:choose>
730 </xsl:for-each> <!-- select="attribute" -->
731 <!-- b) "real" methods after the attributes -->
732 <xsl:for-each select="method">
733 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
734 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('messages for ', $ifname, '::', $methodname, ': method')" /></xsl:call-template>
735 <xsl:comment> method <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$methodname" /> </xsl:comment>
736 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
737 <xsl:choose>
738 <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
739 or (param[@mod='ptr'])" >
740 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
741 </xsl:when>
742 <xsl:when test="@wsmap = 'suppress'">
743 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment>
744 </xsl:when>
745 <xsl:otherwise>
746 <!-- always emit a request message -->
747 <xsl:call-template name="emitRequestMessage">
748 <xsl:with-param name="_ifname" select="$ifname" />
749 <xsl:with-param name="_wsmap" select="$wsmap" />
750 <xsl:with-param name="_methodname" select="$methodname" />
751 <xsl:with-param name="_params" select="param" />
752 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
753 </xsl:call-template>
754 <!-- emit a second "result" message only if the method has "out" arguments or a return value -->
755 <!-- <xsl:if test="(count(param[@dir='out'] | param[@dir='return']) > 0)"> -->
756 <xsl:call-template name="emitResultMessage">
757 <xsl:with-param name="_ifname" select="$ifname" />
758 <xsl:with-param name="_wsmap" select="$wsmap" />
759 <xsl:with-param name="_methodname" select="@name" />
760 <xsl:with-param name="_params" select="param" />
761 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
762 </xsl:call-template>
763 <!-- </xsl:if> -->
764 </xsl:otherwise>
765 </xsl:choose>
766 </xsl:for-each>
767</xsl:template>
768
769<!--
770 function emitOperationsForInterface
771 -->
772<xsl:template name="emitOperationsInPortTypeForInterface">
773 <xsl:param name="ifname" />
774 <xsl:param name="wsmap" />
775
776 <!-- a) again, first for the attributes whose messages we produced above -->
777 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('************* portType for interface &quot;', $ifname, '&quot;')" /></xsl:call-template>
778 <xsl:for-each select="attribute">
779 <xsl:variable name="attrname" select="@name" />
780 <xsl:variable name="attrtype" select="@type" />
781 <xsl:variable name="attrreadonly" select="@readonly" />
782 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('operations for ', $ifname, '::', $attrname, ': attribute of type &quot;', $attrtype, '&quot;, readonly: ', $attrreadonly)" /></xsl:call-template>
783 <xsl:choose>
784 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
785 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
786 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is of a suppressed type')" /></xsl:comment>
787 </xsl:when>
788 <xsl:when test="@wsmap = 'suppress'">
789 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is suppressed')" /></xsl:comment>
790 </xsl:when>
791 <xsl:otherwise>
792 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
793 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $G_attributeGetPrefix, $attrname)" /></xsl:call-template>
794 <xsl:call-template name="emitInOutOperation">
795 <xsl:with-param name="_ifname" select="$ifname" />
796 <xsl:with-param name="_methodname" select="$attrGetter" />
797 <xsl:with-param name="_params" select="/.." />
798 <xsl:with-param name="_resulttype" select='$attrtype' />
799 </xsl:call-template>
800 <xsl:if test="not($attrreadonly='yes')">
801 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
802 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $attrSetter)" /></xsl:call-template>
803 <xsl:call-template name="emitInOutOperation">
804 <xsl:with-param name="_ifname" select="$ifname" />
805 <xsl:with-param name="_methodname" select="$attrSetter" />
806 <xsl:with-param name="_params" select="/.." />
807 <xsl:with-param name="_resulttype" select='$attrtype' />
808 </xsl:call-template>
809 </xsl:if>
810 </xsl:otherwise>
811 </xsl:choose>
812 </xsl:for-each>
813 <!-- b) then for the "real" methods whose messages we produced above -->
814 <xsl:for-each select="method">
815 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
816 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('operations for ', $ifname, '::', $methodname, ': method')" /></xsl:call-template>
817 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
818 <xsl:choose>
819 <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
820 or (param[@mod='ptr'])" >
821 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
822 </xsl:when>
823 <xsl:when test="@wsmap = 'suppress'">
824 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment>
825 </xsl:when>
826 <xsl:otherwise>
827 <xsl:call-template name="emitInOutOperation">
828 <xsl:with-param name="_ifname" select="$ifname" />
829 <xsl:with-param name="_methodname" select="$methodname" />
830 <xsl:with-param name="_params" select="param" />
831 </xsl:call-template>
832 </xsl:otherwise>
833 </xsl:choose>
834 </xsl:for-each>
835</xsl:template>
836
837<!--
838 function emitOperationsInBindingForInterface
839 -->
840<xsl:template name="emitOperationsInBindingForInterface">
841 <xsl:param name="ifname" />
842 <xsl:param name="wsmap" />
843
844 <!-- a) again, first for the attributes whose messages we produced above -->
845 <xsl:for-each select="attribute">
846 <xsl:variable name="attrname" select="@name" />
847 <xsl:variable name="attrtype" select="@type" />
848 <xsl:variable name="attrreadonly" select="@readonly" />
849 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
850 <xsl:choose>
851 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
852 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is of a suppressed type')" /></xsl:comment>
853 </xsl:when>
854 <xsl:when test="@wsmap = 'suppress'">
855 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is suppressed')" /></xsl:comment>
856 </xsl:when>
857 <xsl:otherwise>
858 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
859 <xsl:call-template name="emitInOutOperation">
860 <xsl:with-param name="_ifname" select="$ifname" />
861 <xsl:with-param name="_methodname" select="$attrGetter" />
862 <xsl:with-param name="_params" select="/.." />
863 <xsl:with-param name="_resulttype" select='$attrtype' />
864 <xsl:with-param name="_fSoap" select="1" />
865 </xsl:call-template>
866 <xsl:if test="not($attrreadonly='yes')">
867 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
868 <xsl:call-template name="emitInOutOperation">
869 <xsl:with-param name="_ifname" select="$ifname" />
870 <xsl:with-param name="_methodname" select="$attrSetter" />
871 <xsl:with-param name="_params" select="/.." />
872 <xsl:with-param name="_resulttype" select='$attrtype' />
873 <xsl:with-param name="_fSoap" select="1" />
874 </xsl:call-template>
875 </xsl:if>
876 </xsl:otherwise>
877 </xsl:choose>
878 </xsl:for-each>
879 <!-- b) then for the "real" methods whose messages we produced above -->
880 <xsl:for-each select="method">
881 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
882 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
883 <xsl:choose>
884 <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
885 or (param[@mod='ptr'])" >
886 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
887 </xsl:when>
888 <xsl:when test="@wsmap = 'suppress'">
889 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment>
890 </xsl:when>
891 <xsl:otherwise>
892 <xsl:call-template name="emitInOutOperation">
893 <xsl:with-param name="_ifname" select="$ifname" />
894 <xsl:with-param name="_methodname" select="$methodname" />
895 <xsl:with-param name="_params" select="param" />
896 <xsl:with-param name="_fSoap" select="1" />
897 </xsl:call-template>
898 </xsl:otherwise>
899 </xsl:choose>
900 </xsl:for-each>
901</xsl:template>
902
903<!--**********************************************************************
904 *
905 * matches
906 *
907 **********************************************************************-->
908
909<!--
910 template for "idl" match; this emits the header of the target file
911 and recurses into the libraries with interfaces (which are matched below)
912 -->
913<xsl:template match="/idl">
914 <xsl:comment>
915 DO NOT EDIT! This is a generated file.
916 Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
917 Generator: src/VBox/Main/webservice/websrv-wsdl.xsl
918</xsl:comment>
919
920 <xsl:apply-templates />
921
922</xsl:template>
923
924<!--
925 template for "if" match: ignore all ifs except those for wsdl
926 -->
927<xsl:template match="if">
928 <xsl:if test="@target='wsdl'">
929 <xsl:apply-templates/>
930 </xsl:if>
931</xsl:template>
932
933<!--
934 template for "cpp": ignore
935 -->
936<xsl:template match="cpp">
937<!-- ignore this -->
938</xsl:template>
939
940
941<!-- - - - - - - - - - - - - - - - - - - - - - -
942 class
943 - - - - - - - - - - - - - - - - - - - - - - -->
944
945<xsl:template match="module/class">
946<!-- swallow -->
947</xsl:template>
948
949<!-- - - - - - - - - - - - - - - - - - - - - - -
950 enum
951 - - - - - - - - - - - - - - - - - - - - - - -->
952
953<xsl:template match="enum">
954</xsl:template>
955
956<!-- - - - - - - - - - - - - - - - - - - - - - -
957 desc
958 - - - - - - - - - - - - - - - - - - - - - - -->
959
960<xsl:template match="desc">
961<!-- swallow -->
962</xsl:template>
963
964<!-- - - - - - - - - - - - - - - - - - - - - - -
965 note
966 - - - - - - - - - - - - - - - - - - - - - - -->
967
968<xsl:template match="note">
969 <xsl:apply-templates />
970</xsl:template>
971
972<!--
973 "library" match: we use this to emit most of the WSDL <types> section.
974 With WSDL "document" style, this requires us to go through all interfaces
975 and emit complexTypes for all method arguments and return values.
976-->
977<xsl:template match="library">
978 <wsdl:definitions
979 name="VirtualBox"
980 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
981 <xsl:attribute name="targetNamespace"><xsl:value-of select="$G_targetNamespace" /></xsl:attribute>
982 <!-- at top of WSDL file, dump a <types> section with user-defined types -->
983 <xsl:comment>
984 ******************************************************
985 *
986 * WSDL type definitions in XML Schema
987 *
988 ******************************************************
989</xsl:comment>
990 <wsdl:types>
991 <xsd:schema>
992 <xsl:attribute name="targetNamespace"><xsl:value-of select='$G_targetNamespace' /></xsl:attribute>
993
994 <!-- type-define all enums -->
995 <xsl:comment>
996 ******************************************************
997 * enumerations
998 ******************************************************
999</xsl:comment>
1000 <xsl:for-each select="//enum">
1001 <xsl:comment> enum: <xsl:value-of select="@name" /> -
1002 <xsl:for-each select="const">
1003 <xsl:value-of select="@name" />: <xsl:value-of select="@value" /> -
1004 </xsl:for-each>
1005</xsl:comment>
1006 <xsd:simpleType>
1007 <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>
1008 <xsd:restriction base="xsd:string">
1009 <!-- XML Schema does not seem to have a C-like mapping between identifiers and numbers;
1010 instead, it treats enumerations like strings that can have only specific values. -->
1011 <xsl:for-each select="const">
1012 <xsd:enumeration>
1013 <xsl:attribute name="value"><xsl:value-of select="@name" /></xsl:attribute>
1014 </xsd:enumeration>
1015 </xsl:for-each>
1016 </xsd:restriction>
1017 </xsd:simpleType>
1018 </xsl:for-each>
1019
1020 <!-- type-define all interfaces that have wsmap=struct as structs (complexTypes) -->
1021 <xsl:comment>
1022 ******************************************************
1023 * structs
1024 ******************************************************
1025</xsl:comment>
1026 <xsl:for-each select="//interface[@wsmap='struct']">
1027 <xsl:comment> interface <xsl:value-of select="@name" /> as struct: </xsl:comment>
1028 <xsd:complexType>
1029 <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>
1030 <xsd:sequence>
1031 <xsl:for-each select="attribute">
1032 <xsd:element>
1033 <xsl:attribute name="name"><xsl:value-of select="@name" /></xsl:attribute>
1034 <xsl:attribute name="type">
1035 <xsl:call-template name="emitConvertedType">
1036 <xsl:with-param name="type" select="@type" />
1037 </xsl:call-template>
1038 </xsl:attribute>
1039 </xsd:element>
1040 </xsl:for-each>
1041 </xsd:sequence>
1042 </xsd:complexType>
1043 </xsl:for-each>
1044
1045 <!-- for WSDL 'document' style, we need to emit elements since we can't
1046 refer to types in message parts as with RPC style -->
1047 <xsl:if test="$G_basefmt='document'">
1048 <xsl:comment>
1049 ******************************************************
1050 * elements for message arguments (parts); generated for WSDL 'document' style
1051 ******************************************************
1052</xsl:comment>
1053
1054 <xsl:for-each select="//interface">
1055 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
1056 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
1057
1058 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
1059 <xsl:comment>Interface <xsl:copy-of select="$ifname" /></xsl:comment>
1060 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('************* types: elements for interface &quot;', $ifname, '&quot;')" /></xsl:call-template>
1061 <!-- a) attributes first -->
1062 <xsl:for-each select="attribute">
1063 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
1064 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
1065 <xsl:variable name="attrsafearray"><xsl:value-of select="@safearray" /></xsl:variable>
1066 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
1067 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('elements for ', $ifname, '::', $attrname, ': attribute of type &quot;', $attrtype, '&quot;, readonly: ', $attrreadonly)" /></xsl:call-template>
1068 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
1069 <xsl:choose>
1070 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
1071 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment>
1072 </xsl:when>
1073 <xsl:when test="@wsmap = 'suppress'">
1074 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrname, ' for it is suppressed')" /></xsl:comment>
1075 </xsl:when>
1076 <xsl:otherwise>
1077 <xsl:choose>
1078 <xsl:when test="@readonly='yes'">
1079 <xsl:comment> readonly attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
1080 </xsl:when>
1081 <xsl:otherwise>
1082 <xsl:comment> read/write attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
1083 </xsl:otherwise>
1084 </xsl:choose>
1085 <!-- aa) get method: emit request and result -->
1086 <xsl:call-template name="emitGetAttributeElements">
1087 <xsl:with-param name="ifname" select="$ifname" />
1088 <xsl:with-param name="wsmap" select="$wsmap" />
1089 <xsl:with-param name="attrname" select="$attrname" />
1090 <xsl:with-param name="attrtype" select="$attrtype" />
1091 <xsl:with-param name="attrsafearray" select="$attrsafearray" />
1092 </xsl:call-template>
1093 <!-- bb) emit a set method if the attribute is read/write -->
1094 <xsl:if test="not($attrreadonly='yes')">
1095 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
1096 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $ifname, '::', $attrSetter)" /></xsl:call-template>
1097 <xsl:call-template name="emitRequestElements">
1098 <xsl:with-param name="_ifname" select="$ifname" />
1099 <xsl:with-param name="_wsmap" select="$wsmap" />
1100 <xsl:with-param name="_methodname" select="$attrSetter" />
1101 <xsl:with-param name="_params" select="/.." />
1102 <xsl:with-param name="_valuetype" select="$attrtype" />
1103 <xsl:with-param name="_valuesafearray" select="$attrsafearray" />
1104 </xsl:call-template>
1105 <xsl:call-template name="emitResultElements">
1106 <xsl:with-param name="_ifname" select="$ifname" />
1107 <xsl:with-param name="_methodname" select="$attrSetter" />
1108 <xsl:with-param name="_params" select="/.." />
1109 </xsl:call-template>
1110 </xsl:if>
1111 </xsl:otherwise>
1112 </xsl:choose>
1113 </xsl:for-each> <!-- select="attribute" -->
1114 <!-- b) "real" methods after the attributes -->
1115 <xsl:for-each select="method">
1116 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
1117 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('messages for ', $ifname, '::', $methodname, ': method')" /></xsl:call-template>
1118 <xsl:comment> method <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$methodname" /> </xsl:comment>
1119 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
1120 <xsl:choose>
1121 <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
1122 or (param[@mod='ptr'])" >
1123 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
1124 </xsl:when>
1125 <xsl:when test="@wsmap = 'suppress'">
1126 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it is suppressed')" /></xsl:comment>
1127 </xsl:when>
1128 <xsl:otherwise>
1129 <!-- always emit a request message -->
1130 <xsl:call-template name="emitRequestElements">
1131 <xsl:with-param name="_ifname" select="$ifname" />
1132 <xsl:with-param name="_wsmap" select="$wsmap" />
1133 <xsl:with-param name="_methodname" select="$methodname" />
1134 <xsl:with-param name="_params" select="param" />
1135 </xsl:call-template>
1136 <!-- emit a second "result" message only if the method has "out" arguments or a return value -->
1137 <!-- <xsl:if test="(count(param[@dir='out'] | param[@dir='return']) > 0)"> -->
1138 <xsl:call-template name="emitResultElements">
1139 <xsl:with-param name="_ifname" select="$ifname" />
1140 <xsl:with-param name="_wsmap" select="$wsmap" />
1141 <xsl:with-param name="_methodname" select="$methodname" />
1142 <xsl:with-param name="_params" select="param" />
1143 </xsl:call-template>
1144 <!-- </xsl:if> -->
1145 </xsl:otherwise>
1146 </xsl:choose>
1147 </xsl:for-each>
1148 </xsl:if> <!-- <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'> -->
1149 </xsl:for-each>
1150
1151 </xsl:if> <!-- <xsl:if test="$G_basefmt='document'"> -->
1152
1153 <xsl:comment>
1154 ******************************************************
1155 * faults
1156 ******************************************************
1157</xsl:comment>
1158
1159 <xsd:element name="InvalidObjectFault">
1160 <xsd:complexType>
1161 <xsd:sequence>
1162 <xsd:element name="badObjectID">
1163 <xsl:attribute name="type">
1164 <xsl:value-of select="$G_typeObjectRef" />
1165 </xsl:attribute>
1166 </xsd:element>
1167 </xsd:sequence>
1168 </xsd:complexType>
1169 </xsd:element>
1170
1171 <xsd:element name="RuntimeFault">
1172 <xsd:complexType>
1173 <xsd:sequence>
1174 <xsd:element name="resultCode" type="xsd:int" />
1175 <xsd:element name="returnval">
1176 <xsl:attribute name="type">
1177 <xsl:value-of select="$G_typeObjectRef" />
1178 </xsl:attribute>
1179 </xsd:element>
1180 </xsd:sequence>
1181 </xsd:complexType>
1182 </xsd:element>
1183
1184 <!-- done! -->
1185 </xsd:schema>
1186
1187
1188 </wsdl:types>
1189
1190 <wsdl:message name="InvalidObjectFaultMsg">
1191 <wsdl:part name="fault" element="vbox:InvalidObjectFault" />
1192 </wsdl:message>
1193 <wsdl:message name="RuntimeFaultMsg">
1194 <wsdl:part name="fault" element="vbox:RuntimeFault" />
1195 </wsdl:message>
1196
1197 <xsl:comment>
1198 ******************************************************
1199 *
1200 * messages for all interfaces
1201 *
1202 ******************************************************
1203</xsl:comment>
1204
1205 <xsl:for-each select="//interface">
1206 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
1207 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
1208
1209 <xsl:call-template name="verifyInterface">
1210 <xsl:with-param name="ifname" select="$ifname" />
1211 <xsl:with-param name="wsmap" select="$wsmap" />
1212 </xsl:call-template>
1213
1214 <xsl:comment>
1215 *************************************
1216 messages for interface <xsl:copy-of select="$ifname" />
1217 *************************************
1218 </xsl:comment>
1219
1220 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
1221 <xsl:call-template name="emitMessagesForInterface">
1222 <xsl:with-param name="ifname" select="$ifname" />
1223 <xsl:with-param name="wsmap" select="$wsmap" />
1224 </xsl:call-template>
1225 </xsl:if>
1226 </xsl:for-each>
1227
1228 <xsl:comment>
1229 ******************************************************
1230 *
1231 * one portType for all interfaces
1232 *
1233 ******************************************************
1234 </xsl:comment>
1235
1236 <wsdl:portType>
1237 <xsl:attribute name="name"><xsl:copy-of select="'vbox'" /><xsl:value-of select="$G_portTypeSuffix" /></xsl:attribute>
1238
1239 <xsl:for-each select="//interface">
1240 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
1241 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
1242
1243 <xsl:comment>
1244 *************************************
1245 operations in portType for interface <xsl:copy-of select="$ifname" />
1246 *************************************
1247 </xsl:comment>
1248
1249 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
1250 <xsl:call-template name="emitOperationsInPortTypeForInterface">
1251 <xsl:with-param name="ifname" select="$ifname" />
1252 <xsl:with-param name="wsmap" select="$wsmap" />
1253 </xsl:call-template>
1254 </xsl:if>
1255 </xsl:for-each>
1256 </wsdl:portType>
1257
1258 <xsl:comment>
1259 ******************************************************
1260 *
1261 * one binding for all interfaces
1262 *
1263 ******************************************************
1264 </xsl:comment>
1265
1266 <wsdl:binding>
1267 <xsl:attribute name="name"><xsl:value-of select="concat('vbox', $G_bindingSuffix)" /></xsl:attribute>
1268 <xsl:attribute name="type"><xsl:value-of select="concat('vbox:vbox', $G_portTypeSuffix)" /></xsl:attribute>
1269
1270 <soap:binding>
1271 <xsl:attribute name="style"><xsl:value-of select="$G_basefmt" /></xsl:attribute>
1272 <xsl:attribute name="transport">http://schemas.xmlsoap.org/soap/http</xsl:attribute>
1273 </soap:binding>
1274
1275 <xsl:for-each select="//interface">
1276 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
1277 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
1278
1279 <xsl:comment>
1280 *************************************
1281 operations in portType for interface <xsl:copy-of select="$ifname" />
1282 *************************************
1283 </xsl:comment>
1284
1285 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
1286 <xsl:call-template name="emitOperationsInBindingForInterface">
1287 <xsl:with-param name="ifname" select="$ifname" />
1288 <xsl:with-param name="wsmap" select="$wsmap" />
1289 </xsl:call-template>
1290 </xsl:if>
1291 </xsl:for-each>
1292 </wsdl:binding>
1293
1294 </wsdl:definitions>
1295</xsl:template>
1296
1297
1298</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette