VirtualBox

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

Last change on this file since 21961 was 20888, checked in by vboxsync, 15 years ago

webservice: changes to allow for supporting IDisplay and other interfaces: suppress only methods with [ptr] args, not entire interfaces that use them; better error reporting in jax-ws generator; use common table in include file for type conversions; make takeScreenShotSlow() use dir=return instead of dir=out for one output arg

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