VirtualBox

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

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

header (C) fixes

  • Property svn:eol-style set to native
File size: 63.1 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-2012 Oracle Corporation
13
14 This file is part of VirtualBox Open Source Edition (OSE), as
15 available from http://www.virtualbox.org. This file is free software;
16 you can redistribute it and/or modify it under the terms of the GNU
17 General Public License (GPL) as published by the Free Software
18 Foundation, in version 2 as it comes in the "COPYING" file of the
19 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
20 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
21-->
22
23<!--
24 A WSDL document describes a web service using these major elements:
25 Element Defines
26 <types> The data types used by the web service, described in XML Schema
27 syntax.
28 <message> The messages used by the web service. A message is a function call
29 and with it come "parts", which are the parameters.
30 <portType> The operations performed by the web service. A portType can be thought
31 of as a class or, in COM terms, as an interface.
32 <binding> The communication protocols used by the web service.
33
34 The root tag is <definitions>.
35
36 Representing COM interfaces is tricky in WSDL 1.1, which doesn't really have them.
37 WSDL only knows about "port types", which are an abstract representation
38 of a group of functions. So for each "interface", we need to emit
39 a "port type"; in the port type, we declare each "interface method"
40 as one "operation". Each operation in turn consists of at least one
41 message for the method invocation, which contains all the "in" and
42 "inout" arguments. An optional second message for the response contains
43 the return value, if one is present in the IDL (called "_return" to
44 avoid name clashes), together with all the "out" and "inout" arguments.
45 Each of these messages, however, need to be independently declared
46 using the "message" element outside of the "port type" declaration.
47
48 As an example: To create this XPCOM IDL:
49
50 void createMachine (
51 in wstring baseFolder,
52 in wstring name,
53 [retval] out IMachine machine
54 );
55
56 the following exists in the XIDL:
57
58 <interface name="ifname">
59 <method name="createMachine">
60 <param name="baseFolder" type="wstring" dir="in" />
61 <param name="name" type="wstring" dir="in" />
62 <param name="machine" type="IMachine" dir="return" />
63 </method>
64 </interface>
65
66 So, we have two "in" parameters, and one "out" parameter. The
67 operation therefore requires two messages (one for the request,
68 with the two "in" parameters, and one for the result with the
69 return value). With RPC/encoded style, we end up with this:
70
71 <message name="ifname.methodname_Request">
72 <part name="baseFolder" type="xsd:string" />
73 <part name="name" type="xsd:string" />
74 </message>
75 <message name="ifname.methodname_Result">
76 <part name="_return" type="IMachine" />
77 </message>
78 <portType name="ifname">
79 <operation name="methodname"
80 <input message="ifname.methodname_Request" />
81 <output message="ifname.methodname_Result" />
82 </operation>
83 </portType>
84
85 With document/literal style, things get even more verbose, as
86 instead of listing the arguments and return values in the messages,
87 we declare a struct-like complexType in the <types> section
88 instead and then reference that type in the messages.
89-->
90
91<xsl:stylesheet
92 version="1.0"
93 targetNamespace="http://schemas.xmlsoap.org/wsdl/"
94 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
95 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
96 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
97 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
98 xmlns:vbox="http://www.virtualbox.org/"
99 xmlns:exsl="http://exslt.org/common"
100 extension-element-prefixes="exsl">
101
102<xsl:param name="G_argDebug" />
103
104<xsl:output
105 method="xml"
106 version="1.0"
107 encoding="utf-8"
108 indent="yes"/>
109
110<xsl:strip-space
111 elements="*" />
112
113<!--**********************************************************************
114 *
115 * global XSLT variables
116 *
117 **********************************************************************-->
118
119<xsl:variable name="G_xsltFilename" select="'websrv-wsdl.xsl'" />
120
121<xsl:include href="websrv-shared.inc.xsl" />
122
123<!-- collect all interfaces with "wsmap='suppress'" in a global variable for
124 quick lookup -->
125<xsl:variable name="G_setSuppressedInterfaces"
126 select="//interface[@wsmap='suppress']" />
127
128<!-- this marker is used with WSDL document style to mark that a message
129 should have an automatic type that matches a complexType definition;
130 use a string that cannot possibly appear in an XIDL interface name -->
131<xsl:variable name="G_typeIsGlobalRequestElementMarker"
132 select="'&lt;&lt;&lt;&lt;Request'" />
133<xsl:variable name="G_typeIsGlobalResponseElementMarker"
134 select="'&lt;&lt;&lt;&lt;Response'" />
135
136<!--**********************************************************************
137 *
138 * shared helpers
139 *
140 **********************************************************************-->
141
142<!--
143 function emitConvertedType
144 -->
145<xsl:template name="emitConvertedType">
146 <xsl:param name="ifname" />
147 <xsl:param name="methodname" />
148 <xsl:param name="type" />
149 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('......emitConvertedType: type=&quot;', $type, '&quot;')" /></xsl:call-template>
150 <!-- look up XML Schema type from IDL type from table array in websrv-shared.inc.xsl -->
151 <xsl:variable name="xmltypefield" select="exsl:node-set($G_aSharedTypes)/type[@idlname=$type]/@xmlname" />
152 <xsl:choose>
153 <xsl:when test="$type=$G_typeIsGlobalRequestElementMarker"><xsl:value-of select="concat('vbox:', $ifname, $G_classSeparator, $methodname, $G_requestMessageElementSuffix)" /></xsl:when>
154 <xsl:when test="$type=$G_typeIsGlobalResponseElementMarker"><xsl:value-of select="concat('vbox:', $ifname, $G_classSeparator, $methodname, $G_responseMessageElementSuffix)" /></xsl:when>
155 <!-- if above lookup in table succeeded, use that type -->
156 <xsl:when test="string-length($xmltypefield)"><xsl:value-of select="concat('xsd:', $xmltypefield)" /></xsl:when>
157 <xsl:when test="$type='$unknown'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
158 <xsl:when test="$type='global'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
159 <xsl:when test="$type='managed'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
160 <xsl:when test="$type='explicit'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
161 <!-- enums are easy, these are defined in schema at the top of the wsdl -->
162 <xsl:when test="//enum[@name=$type]"><xsl:value-of select="concat('vbox:', $type)" /></xsl:when>
163 <!-- otherwise test for an interface with this name -->
164 <xsl:when test="//interface[@name=$type]">
165 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
166 <xsl:variable name="wsmap" select="(//interface[@name=$type]/@wsmap) | (//collection[@name=$type]/@wsmap)" />
167 <xsl:choose>
168 <xsl:when test="not($wsmap)">
169 <xsl:call-template name="fatalError">
170 <xsl:with-param name="msg" select="concat('emitConvertedType: Type &quot;', $type, '&quot; in method &quot;', $ifname, '::', $methodname, '&quot; lacks wsmap attribute value in XIDL.')" />
171 </xsl:call-template>
172 </xsl:when>
173 <xsl:when test="$wsmap='struct'"><xsl:value-of select="concat('vbox:', $type)" /></xsl:when>
174 <xsl:when test="$wsmap='global'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
175 <xsl:when test="$wsmap='managed'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
176 <xsl:when test="$wsmap='explicit'"><xsl:value-of select="$G_typeObjectRef" /></xsl:when>
177 <xsl:when test="$wsmap='suppress'">
178 <xsl:call-template name="fatalError">
179 <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.')" />
180 </xsl:call-template>
181 </xsl:when>
182 <xsl:otherwise>
183 <xsl:call-template name="fatalError">
184 <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;')" />
185 </xsl:call-template>
186 </xsl:otherwise>
187 </xsl:choose>
188 </xsl:when>
189 <xsl:when test="//collection[@name=$type]">
190 <xsl:value-of select="concat('vbox:ArrayOf', //collection[@name=$type]/@type)" />
191 </xsl:when>
192 <xsl:otherwise>
193 <xsl:call-template name="fatalError">
194 <xsl:with-param name="msg" select="concat('emitConvertedType: Unknown type &quot;', $type, '&quot; used in method &quot;', $ifname, '::', $methodname, '&quot;.')" />
195 </xsl:call-template>
196 </xsl:otherwise>
197 </xsl:choose>
198</xsl:template>
199
200<!--
201 function convertTypeAndEmitPartOrElement
202 -->
203<xsl:template name="convertTypeAndEmitPartOrElement">
204 <xsl:param name="ifname" />
205 <xsl:param name="methodname" />
206 <xsl:param name="name" />
207 <xsl:param name="type" />
208 <xsl:param name="safearray" /> <!-- "yes" if XIDL has safearray=yes -->
209 <xsl:param name="elname" /> <!-- "part" or "element" -->
210 <xsl:param name="attrname" /> <!-- attrib of part or element: <part type=...> or <part element=...> or <element type=...> -->
211
212 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('....convertTypeAndEmitPartOrElement: arg name: ', $name)" /></xsl:call-template>
213 <xsl:choose>
214 <xsl:when test="$safearray='yes' and $type='octet'">
215 <!-- we pass octet arrays as Base64-encoded strings. -->
216 <xsl:element name="{$elname}">
217 <xsl:attribute name="name"><xsl:value-of select="$name" /></xsl:attribute>
218 <xsl:attribute name="type"><xsl:value-of select="'xsd:string'" /></xsl:attribute>
219 </xsl:element>
220 </xsl:when>
221
222 <xsl:when test="$safearray='yes'">
223 <xsl:element name="{$elname}"> <!-- <part> or <element> -->
224 <xsl:attribute name="name"><xsl:value-of select="$name" /></xsl:attribute>
225 <xsl:attribute name="minOccurs"><xsl:value-of select="'0'" /></xsl:attribute>
226 <xsl:attribute name="maxOccurs"><xsl:value-of select="'unbounded'" /></xsl:attribute>
227 <xsl:attribute name="{$attrname}">
228 <xsl:call-template name="emitConvertedType">
229 <xsl:with-param name="ifname" select="$ifname" />
230 <xsl:with-param name="methodname" select="$methodname" />
231 <xsl:with-param name="type" select="$type" />
232 </xsl:call-template>
233 </xsl:attribute>
234 </xsl:element>
235 </xsl:when>
236 <xsl:otherwise>
237 <xsl:element name="{$elname}"> <!-- <part> or <element> -->
238 <xsl:attribute name="name"><xsl:value-of select="$name" /></xsl:attribute>
239 <xsl:attribute name="{$attrname}">
240 <xsl:call-template name="emitConvertedType">
241 <xsl:with-param name="ifname" select="$ifname" />
242 <xsl:with-param name="methodname" select="$methodname" />
243 <xsl:with-param name="type" select="$type" />
244 </xsl:call-template>
245 </xsl:attribute>
246 </xsl:element>
247 </xsl:otherwise>
248 </xsl:choose>
249</xsl:template>
250
251<!--
252 function emitRequestArgs
253 -->
254<xsl:template name="emitRequestArgs">
255 <xsl:param name="_ifname" /> <!-- interface name -->
256 <xsl:param name="_wsmap" /> <!-- interface's wsmap attribute -->
257 <xsl:param name="_methodname" />
258 <xsl:param name="_params" />
259 <xsl:param name="_valuetype" /> <!-- optional, for attribute setter messages -->
260 <xsl:param name="_valuesafearray" /> <!-- optional, 'yes' if attribute of setter has safearray=yes -->
261 <xsl:param name="_elname" /> <!-- "part" or "xsd:element" -->
262 <xsl:param name="_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
263
264 <!-- first parameter will be object on which method is called, depending on wsmap attribute -->
265 <xsl:choose>
266 <xsl:when test="($_wsmap='managed') or ($_wsmap='explicit')">
267 <xsl:call-template name="convertTypeAndEmitPartOrElement">
268 <xsl:with-param name="ifname" select="$_ifname" />
269 <xsl:with-param name="methodname" select="$_methodname" />
270 <xsl:with-param name="name" select="$G_nameObjectRef" />
271 <xsl:with-param name="type" select="$_wsmap" />
272 <xsl:with-param name="safearray" select="'no'" />
273 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
274 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
275 </xsl:call-template>
276 </xsl:when>
277 </xsl:choose>
278 <!-- now for the real parameters, if any -->
279 <xsl:for-each select="$_params">
280 <!-- emit only parts for "in" parameters -->
281 <xsl:if test="@dir='in'">
282 <xsl:call-template name="convertTypeAndEmitPartOrElement">
283 <xsl:with-param name="ifname" select="$_ifname" />
284 <xsl:with-param name="methodname" select="$_methodname" />
285 <xsl:with-param name="name" select="@name" />
286 <xsl:with-param name="type" select="@type" />
287 <xsl:with-param name="safearray" select="@safearray" />
288 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
289 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
290 </xsl:call-template>
291 </xsl:if>
292 </xsl:for-each>
293 <xsl:if test="$_valuetype">
294 <!-- <part>
295 <xsl:attribute name="name">value</xsl:attribute>
296 <xsl:attribute name="type"><xsl:value-of select='string($_valuetype)' /></xsl:attribute>
297 </part> -->
298 <xsl:call-template name="convertTypeAndEmitPartOrElement">
299 <xsl:with-param name="ifname" select="$_ifname" />
300 <xsl:with-param name="methodname" select="$_methodname" />
301 <xsl:with-param name="name" select="@name" />
302 <xsl:with-param name="type" select="@type" />
303 <xsl:with-param name="safearray" select="@safearray" />
304 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
305 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
306 </xsl:call-template>
307 </xsl:if>
308</xsl:template>
309
310<!--
311 function emitResultArgs
312 -->
313<xsl:template name="emitResultArgs">
314 <xsl:param name="_ifname" />
315 <xsl:param name="_methodname" />
316 <xsl:param name="_params" /> <!-- set of parameter elements -->
317 <xsl:param name="_resulttype" /> <!-- for attribute getter methods only -->
318 <xsl:param name="_resultsafearray" /> <!-- for attribute getter methods only -->
319 <xsl:param name="_elname" /> <!-- "part" or "xsd:element" -->
320 <xsl:param name="_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
321
322 <xsl:choose>
323 <xsl:when test="$_resulttype">
324 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $_ifname, '::', $_methodname, ': ', 'resultmsg for attr of type ', $_resulttype)" /></xsl:call-template>
325 <xsl:call-template name="convertTypeAndEmitPartOrElement">
326 <xsl:with-param name="ifname" select="$_ifname" />
327 <xsl:with-param name="methodname" select="$_methodname" />
328 <xsl:with-param name="name" select="$G_result" />
329 <xsl:with-param name="type" select="$_resulttype" />
330 <xsl:with-param name="safearray" select="$_resultsafearray" />
331 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
332 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
333 </xsl:call-template>
334 </xsl:when>
335 <xsl:otherwise>
336 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', 'resultmsg for method: ', $_ifname, '::', $_methodname)" /></xsl:call-template>
337 <xsl:for-each select="$_params">
338 <!-- emit only parts for "out" parameters -->
339 <xsl:if test="@dir='out'">
340 <xsl:call-template name="convertTypeAndEmitPartOrElement">
341 <xsl:with-param name="ifname" select="$_ifname" />
342 <xsl:with-param name="methodname" select="$_methodname" />
343 <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
344 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
345 <xsl:with-param name="safearray" select="@safearray" />
346 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
347 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
348 </xsl:call-template>
349 </xsl:if>
350 <xsl:if test="@dir='return'">
351 <xsl:call-template name="convertTypeAndEmitPartOrElement">
352 <xsl:with-param name="ifname" select="$_ifname" />
353 <xsl:with-param name="methodname" select="$_methodname" />
354 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
355 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
356 <xsl:with-param name="safearray" select="@safearray" />
357 <xsl:with-param name="elname" select="$_elname" /> <!-- "part" or "element" -->
358 <xsl:with-param name="attrname" select="$_attrname" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
359 </xsl:call-template>
360 </xsl:if>
361 </xsl:for-each>
362 </xsl:otherwise>
363 </xsl:choose>
364</xsl:template>
365
366<!--
367 function emitRequestElements:
368 for "in" parameters
369 -->
370<xsl:template name="emitRequestElements">
371 <xsl:param name="_ifname" /> <!-- interface name -->
372 <xsl:param name="_wsmap" /> <!-- interface's wsmap attribute -->
373 <xsl:param name="_methodname" />
374 <xsl:param name="_params" />
375 <xsl:param name="_valuetype" /> <!-- optional, for attribute setter messages -->
376 <xsl:param name="_valuesafearray" /> <!-- optional, 'yes' if attribute of setter has safearray=yes -->
377
378 <xsd:element>
379 <xsl:attribute name="name"><xsl:value-of select="concat($_ifname, $G_classSeparator, $_methodname, $G_requestMessageElementSuffix)" /></xsl:attribute>
380 <xsd:complexType>
381 <xsd:sequence>
382 <xsl:call-template name="emitRequestArgs">
383 <xsl:with-param name="_ifname" select="$_ifname" /> <!-- interface name -->
384 <xsl:with-param name="_wsmap" select="$_wsmap" /> <!-- interface's wsmap attribute -->
385 <xsl:with-param name="_methodname" select="$_methodname" />
386 <xsl:with-param name="_params" select="$_params" />
387 <xsl:with-param name="_valuetype" select="$_valuetype" /> <!-- optional, for attribute setter messages -->
388 <xsl:with-param name="_valuesafearray" select="$_valuesafearray" /> <!-- optional, for attribute setter messages -->
389 <xsl:with-param name="_elname" select="'xsd:element'" /> <!-- "part" or "xsd:element" -->
390 <xsl:with-param name="_attrname" select="'type'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
391 </xsl:call-template>
392 </xsd:sequence>
393 </xsd:complexType>
394 </xsd:element>
395</xsl:template>
396
397<!--
398 function emitResultElements:
399 for "out" and "return" parameters
400 -->
401<xsl:template name="emitResultElements">
402 <xsl:param name="_ifname" />
403 <xsl:param name="_methodname" />
404 <xsl:param name="_params" /> <!-- set of parameter elements -->
405 <xsl:param name="_resulttype" /> <!-- optional, for attribute getter methods only -->
406 <xsl:param name="_resultsafearray" /> <!-- optional, 'yes' if attribute of getter has safearray=yes -->
407
408 <xsd:element>
409 <xsl:attribute name="name"><xsl:value-of select="concat($_ifname, $G_classSeparator, $_methodname, $G_responseMessageElementSuffix)" /></xsl:attribute>
410 <xsd:complexType>
411 <xsd:sequence>
412 <xsl:call-template name="emitResultArgs">
413 <xsl:with-param name="_ifname" select="$_ifname" />
414 <xsl:with-param name="_methodname" select="$_methodname" />
415 <xsl:with-param name="_params" select="$_params" /> <!-- set of parameter elements -->
416 <xsl:with-param name="_resulttype" select="$_resulttype" /> <!-- for attribute getter methods only -->
417 <xsl:with-param name="_resultsafearray" select="$_resultsafearray" /> <!-- for attribute getter methods only -->
418 <xsl:with-param name="_elname" select="'xsd:element'" /> <!-- "part" or "xsd:element" -->
419 <xsl:with-param name="_attrname" select="'type'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
420 </xsl:call-template>
421 </xsd:sequence>
422 </xsd:complexType>
423 </xsd:element>
424</xsl:template>
425
426<!--
427 function emitGetAttributeElements
428 -->
429<xsl:template name="emitGetAttributeElements">
430 <xsl:param name="ifname" />
431 <xsl:param name="wsmap" />
432 <xsl:param name="attrname" />
433 <xsl:param name="attrtype" />
434 <xsl:param name="attrsafearray" />
435
436 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
437 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $ifname, '::', $attrGetter)" /></xsl:call-template>
438 <xsl:call-template name="emitRequestElements">
439 <xsl:with-param name="_ifname" select="$ifname" />
440 <xsl:with-param name="_wsmap" select="$wsmap" />
441 <xsl:with-param name="_methodname" select="$attrGetter" />
442 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
443 </xsl:call-template>
444 <xsl:call-template name="emitResultElements">
445 <xsl:with-param name="_ifname" select="$ifname" />
446 <xsl:with-param name="_methodname" select="$attrGetter" />
447 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
448 <xsl:with-param name="_resulttype" select='$attrtype' />
449 <xsl:with-param name="_resultsafearray" select='$attrsafearray' />
450 </xsl:call-template>
451</xsl:template>
452
453<!--
454 function: emitRequestMessage
455 for "in" parameters
456-->
457<xsl:template name="emitRequestMessage">
458 <xsl:param name="_ifname" /> <!-- interface name -->
459 <xsl:param name="_wsmap" /> <!-- interface's wsmap attribute -->
460 <xsl:param name="_methodname" />
461 <xsl:param name="_params" />
462 <xsl:param name="_valuetype" /> <!-- optional, for attribute setter messages -->
463
464 <wsdl:message>
465 <xsl:attribute name="name"><xsl:value-of select="concat($_ifname, $G_classSeparator, $_methodname, $G_methodRequest)" /></xsl:attribute>
466
467 <xsl:call-template name="convertTypeAndEmitPartOrElement">
468 <xsl:with-param name="ifname" select="$_ifname" />
469 <xsl:with-param name="methodname" select="$_methodname" />
470 <xsl:with-param name="name" select="'parameters'" />
471 <xsl:with-param name="type" select="$G_typeIsGlobalRequestElementMarker" />
472 <xsl:with-param name="safearray" select="'no'" />
473 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
474 <xsl:with-param name="attrname" select="'element'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
475 </xsl:call-template>
476 </wsdl:message>
477</xsl:template>
478
479<!--
480 function: emitResultMessage
481 for "out" and "return" parameters
482-->
483<xsl:template name="emitResultMessage">
484 <xsl:param name="_ifname" />
485 <xsl:param name="_methodname" />
486 <xsl:param name="_params" /> <!-- set of parameter elements -->
487 <xsl:param name="_resulttype" /> <!-- for attribute getter methods only -->
488
489 <wsdl:message>
490 <xsl:attribute name="name"><xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodResponse" /></xsl:attribute>
491
492 <!-- <xsl:variable name="cOutParams" select="count($_params[@dir='out']) + count($_params[@dir='return'])" /> -->
493 <xsl:call-template name="convertTypeAndEmitPartOrElement">
494 <xsl:with-param name="ifname" select="$_ifname" />
495 <xsl:with-param name="methodname" select="$_methodname" />
496 <xsl:with-param name="name" select="'parameters'" />
497 <xsl:with-param name="type" select="$G_typeIsGlobalResponseElementMarker" />
498 <xsl:with-param name="safearray" select="'no'" />
499 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
500 <xsl:with-param name="attrname" select="'element'" /> <!-- attrib of part of element: <part type=...> or <part element=...> or <element type=...> -->
501 </xsl:call-template>
502 </wsdl:message>
503</xsl:template>
504
505<!--
506 function emitGetAttributeMessages:
507-->
508<xsl:template name="emitGetAttributeMessages">
509 <xsl:param name="ifname" />
510 <xsl:param name="wsmap" />
511 <xsl:param name="attrname" />
512 <xsl:param name="attrtype" />
513
514 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
515 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $ifname, '::', $attrGetter)" /></xsl:call-template>
516 <xsl:call-template name="emitRequestMessage">
517 <xsl:with-param name="_ifname" select="$ifname" />
518 <xsl:with-param name="_wsmap" select="$wsmap" />
519 <xsl:with-param name="_methodname" select="$attrGetter" />
520 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
521 </xsl:call-template>
522 <xsl:call-template name="emitResultMessage">
523 <xsl:with-param name="_ifname" select="$ifname" />
524 <xsl:with-param name="_methodname" select="$attrGetter" />
525 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
526 <xsl:with-param name="_resulttype" select='$attrtype' />
527 </xsl:call-template>
528</xsl:template>
529
530<!--
531 function emitSetAttributeMessages
532 -->
533<xsl:template name="emitSetAttributeMessages">
534 <xsl:param name="ifname" select="$ifname" />
535 <xsl:param name="wsmap" select="$wsmap" />
536 <xsl:param name="attrname" select="$attrname" />
537 <xsl:param name="attrtype" select="$attrtype" />
538
539 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
540 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $ifname, '::', $attrSetter)" /></xsl:call-template>
541 <xsl:call-template name="emitRequestMessage">
542 <xsl:with-param name="_ifname" select="$ifname" />
543 <xsl:with-param name="_wsmap" select="$wsmap" />
544 <xsl:with-param name="_methodname" select="$attrSetter" />
545 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
546 <xsl:with-param name="_valuetype" select="$attrtype" />
547 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
548 </xsl:call-template>
549 <xsl:call-template name="emitResultMessage">
550 <xsl:with-param name="_ifname" select="$ifname" />
551 <xsl:with-param name="_methodname" select="$attrSetter" />
552 <xsl:with-param name="_params" select="/.." /> <!-- empty set -->
553 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
554 </xsl:call-template>
555</xsl:template>
556
557<!--
558 function emitInOutOperation:
559 referencing the messages that must have been emitted previously
560-->
561<xsl:template name="emitInOutOperation">
562 <xsl:param name="_ifname" /> <!-- interface name -->
563 <xsl:param name="_methodname" /> <!-- method name -->
564 <xsl:param name="_params" />
565 <xsl:param name="_resulttype" /> <!-- for attribute getter methods only -->
566 <xsl:param name="_fSoap" />
567
568 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('....emitInOutOperation ', $_ifname, '::', $_methodname)" /></xsl:call-template>
569
570 <wsdl:operation>
571 <xsl:attribute name="name">
572 <xsl:value-of select="concat($_ifname, '_', $_methodname)" />
573 </xsl:attribute>
574 <xsl:if test="$_fSoap">
575 <soap:operation>
576 <!-- VMware has an empty attribute like this as well -->
577 <xsl:attribute name="soapAction"><xsl:value-of select="''" /></xsl:attribute>
578 <xsl:attribute name="style"><xsl:value-of select="$G_basefmt" /></xsl:attribute>
579 </soap:operation>
580 </xsl:if>
581 <wsdl:input>
582 <xsl:choose>
583 <xsl:when test="$_fSoap">
584 <soap:body>
585 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
586 <!-- avoid jax-ws warning: <xsl:attribute name="namespace"><xsl:value-of select="concat($G_targetNamespace, $G_targetNamespaceSeparator)" /></xsl:attribute>-->
587 </soap:body>
588 </xsl:when>
589 <xsl:otherwise>
590 <xsl:attribute name="message">vbox:<xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodRequest" /></xsl:attribute>
591 </xsl:otherwise>
592 </xsl:choose>
593 </wsdl:input>
594 <xsl:choose>
595 <xsl:when test="$_resulttype">
596 <wsdl:output>
597 <xsl:choose>
598 <xsl:when test="$_fSoap">
599 <soap:body>
600 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
601 <!-- avoid jax-ws warning: <xsl:attribute name="namespace"><xsl:value-of select="concat($G_targetNamespace, $G_targetNamespaceSeparator)" /></xsl:attribute> -->
602 </soap:body>
603 </xsl:when>
604 <xsl:otherwise>
605 <xsl:attribute name="message">vbox:<xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodResponse" /></xsl:attribute>
606 </xsl:otherwise>
607 </xsl:choose>
608 </wsdl:output>
609 </xsl:when>
610 <xsl:otherwise>
611 <!-- <xsl:if test="count($_params[@dir='out'] | $_params[@dir='return']) > 0"> -->
612 <wsdl:output>
613 <xsl:choose>
614 <xsl:when test="$_fSoap">
615 <soap:body>
616 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
617 <!-- avoid jax-ws warning: <xsl:attribute name="namespace"><xsl:value-of select="concat($G_targetNamespace, $G_targetNamespaceSeparator)" /></xsl:attribute> -->
618 </soap:body>
619 </xsl:when>
620 <xsl:otherwise>
621 <xsl:attribute name="message">vbox:<xsl:copy-of select="$_ifname" /><xsl:value-of select="$G_classSeparator" /><xsl:value-of select="$_methodname" /><xsl:copy-of select="$G_methodResponse" /></xsl:attribute>
622 </xsl:otherwise>
623 </xsl:choose>
624 </wsdl:output>
625 <!-- </xsl:if> -->
626 </xsl:otherwise>
627 </xsl:choose>
628 <xsl:choose>
629 <xsl:when test="not($_fSoap)">
630 <wsdl:fault name="InvalidObjectFault" message="vbox:InvalidObjectFaultMsg" />
631 <wsdl:fault name="RuntimeFault" message="vbox:RuntimeFaultMsg" />
632 </xsl:when>
633 <xsl:otherwise>
634 <wsdl:fault name="InvalidObjectFault">
635 <soap:fault name="InvalidObjectFault">
636 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
637 </soap:fault>
638 </wsdl:fault>
639 <wsdl:fault name="RuntimeFault">
640 <soap:fault name="RuntimeFault">
641 <xsl:attribute name="use"><xsl:value-of select="$G_parmfmt" /></xsl:attribute>
642 </soap:fault>
643 </wsdl:fault>
644 </xsl:otherwise>
645 </xsl:choose>
646 </wsdl:operation>
647</xsl:template>
648
649<!--
650 function verifyInterface
651-->
652<xsl:template name="verifyInterface">
653 <xsl:param name="ifname" />
654 <xsl:param name="wsmap" />
655
656 <xsl:choose>
657 <xsl:when test="$wsmap='global'" />
658 <xsl:when test="$wsmap='managed'" />
659 <xsl:when test="$wsmap='explicit'" />
660 <xsl:when test="$wsmap='struct'" />
661 <xsl:when test="$wsmap='suppress'" />
662 <xsl:otherwise>
663 <xsl:call-template name="fatalError">
664 <xsl:with-param name="msg" select="concat(local-name(), ' template: Interface &quot;', $ifname, '&quot; has invalid wsmap attribute &quot;', $wsmap, '&quot; in XIDL.')" />
665 </xsl:call-template>
666 </xsl:otherwise>
667 </xsl:choose>
668
669 <!-- now make sure we have each interface only once -->
670 <xsl:if test="(count(//library/interface[@name=$ifname]) > 1)">
671 <xsl:call-template name="fatalError">
672 <xsl:with-param name="msg" select="concat(local-name(), ' template: There is more than one interface with a name=&quot;', $ifname, '&quot; attribute.')" />
673 </xsl:call-template>
674 </xsl:if>
675</xsl:template>
676
677<!--
678 function emitMessagesForInterface
679-->
680<xsl:template name="emitMessagesForInterface">
681 <xsl:param name="ifname" />
682 <xsl:param name="wsmap" />
683
684 <!-- 1) outside the portType, here come the in/out methods for all the "operations" we declare below;
685 a) for attributes (get/set methods)
686 b) for "real" methods
687 -->
688 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('************* messages for interface &quot;', $ifname, '&quot;')" /></xsl:call-template>
689 <!-- a) attributes first -->
690 <xsl:for-each select="attribute">
691 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
692 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
693 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
694 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('messages for ', $ifname, '::', $attrname, ': attribute of type &quot;', $attrtype, '&quot;, readonly: ', $attrreadonly)" /></xsl:call-template>
695 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
696 <xsl:choose>
697 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
698 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment>
699 </xsl:when>
700 <xsl:otherwise>
701 <xsl:choose>
702 <xsl:when test="@readonly='yes'">
703 <xsl:comment> readonly attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
704 </xsl:when>
705 <xsl:otherwise>
706 <xsl:comment> read/write attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
707 </xsl:otherwise>
708 </xsl:choose>
709 <!-- aa) get method: emit request and result -->
710 <xsl:call-template name="emitGetAttributeMessages">
711 <xsl:with-param name="ifname" select="$ifname" />
712 <xsl:with-param name="wsmap" select="$wsmap" />
713 <xsl:with-param name="attrname" select="$attrname" />
714 <xsl:with-param name="attrtype" select="$attrtype" />
715 </xsl:call-template>
716 <!-- bb) emit a set method if the attribute is read/write -->
717 <xsl:if test="not($attrreadonly='yes')">
718 <xsl:call-template name="emitSetAttributeMessages">
719 <xsl:with-param name="ifname" select="$ifname" />
720 <xsl:with-param name="wsmap" select="$wsmap" />
721 <xsl:with-param name="attrname" select="$attrname" />
722 <xsl:with-param name="attrtype" select="$attrtype" />
723 </xsl:call-template>
724 </xsl:if>
725 </xsl:otherwise>
726 </xsl:choose>
727 </xsl:for-each> <!-- select="attribute" -->
728 <!-- b) "real" methods after the attributes -->
729 <xsl:for-each select="method">
730 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
731 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('messages for ', $ifname, '::', $methodname, ': method')" /></xsl:call-template>
732 <xsl:comment> method <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$methodname" /> </xsl:comment>
733 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
734 <xsl:choose>
735 <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
736 or (param[@mod='ptr'])" >
737 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
738 </xsl:when>
739 <xsl:otherwise>
740 <!-- always emit a request message -->
741 <xsl:call-template name="emitRequestMessage">
742 <xsl:with-param name="_ifname" select="$ifname" />
743 <xsl:with-param name="_wsmap" select="$wsmap" />
744 <xsl:with-param name="_methodname" select="$methodname" />
745 <xsl:with-param name="_params" select="param" />
746 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
747 </xsl:call-template>
748 <!-- emit a second "result" message only if the method has "out" arguments or a return value -->
749 <!-- <xsl:if test="(count(param[@dir='out'] | param[@dir='return']) > 0)"> -->
750 <xsl:call-template name="emitResultMessage">
751 <xsl:with-param name="_ifname" select="$ifname" />
752 <xsl:with-param name="_wsmap" select="$wsmap" />
753 <xsl:with-param name="_methodname" select="@name" />
754 <xsl:with-param name="_params" select="param" />
755 <xsl:with-param name="elname" select="'wsdl:part'" /> <!-- "part" or "element" -->
756 </xsl:call-template>
757 <!-- </xsl:if> -->
758 </xsl:otherwise>
759 </xsl:choose>
760 </xsl:for-each>
761</xsl:template>
762
763<!--
764 function emitOperationsForInterface
765 -->
766<xsl:template name="emitOperationsInPortTypeForInterface">
767 <xsl:param name="ifname" />
768 <xsl:param name="wsmap" />
769
770 <!-- a) again, first for the attributes whose messages we produced above -->
771 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('************* portType for interface &quot;', $ifname, '&quot;')" /></xsl:call-template>
772 <xsl:for-each select="attribute">
773 <xsl:variable name="attrname" select="@name" />
774 <xsl:variable name="attrtype" select="@type" />
775 <xsl:variable name="attrreadonly" select="@readonly" />
776 <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>
777 <xsl:choose>
778 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
779 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
780 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment>
781 </xsl:when>
782 <xsl:otherwise>
783 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
784 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $G_attributeGetPrefix, $attrname)" /></xsl:call-template>
785 <xsl:call-template name="emitInOutOperation">
786 <xsl:with-param name="_ifname" select="$ifname" />
787 <xsl:with-param name="_methodname" select="$attrGetter" />
788 <xsl:with-param name="_params" select="/.." />
789 <xsl:with-param name="_resulttype" select='$attrtype' />
790 </xsl:call-template>
791 <xsl:if test="not($attrreadonly='yes')">
792 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
793 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $attrSetter)" /></xsl:call-template>
794 <xsl:call-template name="emitInOutOperation">
795 <xsl:with-param name="_ifname" select="$ifname" />
796 <xsl:with-param name="_methodname" select="$attrSetter" />
797 <xsl:with-param name="_params" select="/.." />
798 <xsl:with-param name="_resulttype" select='$attrtype' />
799 </xsl:call-template>
800 </xsl:if>
801 </xsl:otherwise>
802 </xsl:choose>
803 </xsl:for-each>
804 <!-- b) then for the "real" methods whose messages we produced above -->
805 <xsl:for-each select="method">
806 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
807 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('operations for ', $ifname, '::', $methodname, ': method')" /></xsl:call-template>
808 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
809 <xsl:choose>
810 <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
811 or (param[@mod='ptr'])" >
812 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
813 </xsl:when>
814 <xsl:otherwise>
815 <xsl:call-template name="emitInOutOperation">
816 <xsl:with-param name="_ifname" select="$ifname" />
817 <xsl:with-param name="_methodname" select="$methodname" />
818 <xsl:with-param name="_params" select="param" />
819 </xsl:call-template>
820 </xsl:otherwise>
821 </xsl:choose>
822 </xsl:for-each>
823</xsl:template>
824
825<!--
826 function emitOperationsInBindingForInterface
827 -->
828<xsl:template name="emitOperationsInBindingForInterface">
829 <xsl:param name="ifname" />
830 <xsl:param name="wsmap" />
831
832 <!-- a) again, first for the attributes whose messages we produced above -->
833 <xsl:for-each select="attribute">
834 <xsl:variable name="attrname" select="@name" />
835 <xsl:variable name="attrtype" select="@type" />
836 <xsl:variable name="attrreadonly" select="@readonly" />
837 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
838 <xsl:choose>
839 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
840 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment>
841 </xsl:when>
842 <xsl:otherwise>
843 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
844 <xsl:call-template name="emitInOutOperation">
845 <xsl:with-param name="_ifname" select="$ifname" />
846 <xsl:with-param name="_methodname" select="$attrGetter" />
847 <xsl:with-param name="_params" select="/.." />
848 <xsl:with-param name="_resulttype" select='$attrtype' />
849 <xsl:with-param name="_fSoap" select="1" />
850 </xsl:call-template>
851 <xsl:if test="not($attrreadonly='yes')">
852 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
853 <xsl:call-template name="emitInOutOperation">
854 <xsl:with-param name="_ifname" select="$ifname" />
855 <xsl:with-param name="_methodname" select="$attrSetter" />
856 <xsl:with-param name="_params" select="/.." />
857 <xsl:with-param name="_resulttype" select='$attrtype' />
858 <xsl:with-param name="_fSoap" select="1" />
859 </xsl:call-template>
860 </xsl:if>
861 </xsl:otherwise>
862 </xsl:choose>
863 </xsl:for-each>
864 <!-- b) then for the "real" methods whose messages we produced above -->
865 <xsl:for-each select="method">
866 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
867 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
868 <xsl:choose>
869 <xsl:when test=" (param[@type=($G_setSuppressedInterfaces/@name)])
870 or (param[@mod='ptr'])" >
871 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
872 </xsl:when>
873 <xsl:otherwise>
874 <xsl:call-template name="emitInOutOperation">
875 <xsl:with-param name="_ifname" select="$ifname" />
876 <xsl:with-param name="_methodname" select="$methodname" />
877 <xsl:with-param name="_params" select="param" />
878 <xsl:with-param name="_fSoap" select="1" />
879 </xsl:call-template>
880 </xsl:otherwise>
881 </xsl:choose>
882 </xsl:for-each>
883</xsl:template>
884
885<!--**********************************************************************
886 *
887 * matches
888 *
889 **********************************************************************-->
890
891<!--
892 template for "idl" match; this emits the header of the target file
893 and recurses into the libraries with interfaces (which are matched below)
894 -->
895<xsl:template match="/idl">
896 <xsl:comment>
897 DO NOT EDIT! This is a generated file.
898 Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
899 Generator: src/VBox/Main/webservice/websrv-wsdl.xsl
900</xsl:comment>
901
902 <xsl:apply-templates />
903
904</xsl:template>
905
906<!--
907 template for "if" match: ignore all ifs except those for wsdl
908 -->
909<xsl:template match="if">
910 <xsl:if test="@target='wsdl'">
911 <xsl:apply-templates/>
912 </xsl:if>
913</xsl:template>
914
915<!--
916 template for "cpp": ignore
917 -->
918<xsl:template match="cpp">
919<!-- ignore this -->
920</xsl:template>
921
922
923<!-- - - - - - - - - - - - - - - - - - - - - - -
924 class
925 - - - - - - - - - - - - - - - - - - - - - - -->
926
927<xsl:template match="module/class">
928<!-- swallow -->
929</xsl:template>
930
931<!-- - - - - - - - - - - - - - - - - - - - - - -
932 enum
933 - - - - - - - - - - - - - - - - - - - - - - -->
934
935<xsl:template match="enum">
936</xsl:template>
937
938<!-- - - - - - - - - - - - - - - - - - - - - - -
939 desc
940 - - - - - - - - - - - - - - - - - - - - - - -->
941
942<xsl:template match="desc">
943<!-- swallow -->
944</xsl:template>
945
946<!-- - - - - - - - - - - - - - - - - - - - - - -
947 note
948 - - - - - - - - - - - - - - - - - - - - - - -->
949
950<xsl:template match="note">
951 <xsl:apply-templates />
952</xsl:template>
953
954<!--
955 "library" match: we use this to emit most of the WSDL <types> section.
956 With WSDL "document" style, this requires us to go through all interfaces
957 and emit complexTypes for all method arguments and return values.
958-->
959<xsl:template match="library">
960 <wsdl:definitions
961 name="VirtualBox"
962 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
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 <wsdl: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 </wsdl:types>
1197
1198 <wsdl:message name="InvalidObjectFaultMsg">
1199 <wsdl:part name="fault" element="vbox:InvalidObjectFault" />
1200 </wsdl:message>
1201 <wsdl:message name="RuntimeFaultMsg">
1202 <wsdl:part name="fault" element="vbox:RuntimeFault" />
1203 </wsdl: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 <wsdl: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 </wsdl:portType>
1265
1266 <xsl:comment>
1267 ******************************************************
1268 *
1269 * one binding for all interfaces
1270 *
1271 ******************************************************
1272 </xsl:comment>
1273
1274 <wsdl: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 </wsdl:binding>
1301
1302 </wsdl: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