VirtualBox

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

Last change on this file since 43103 was 43103, checked in by vboxsync, 12 years ago

whitespace/comment touchup

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