VirtualBox

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

Last change on this file since 26600 was 26370, checked in by vboxsync, 15 years ago

Webservice: code documentation

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