VirtualBox

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

Last change on this file since 33944 was 33540, checked in by vboxsync, 14 years ago

*: spelling fixes, thanks Timeless!

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