VirtualBox

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

Last change on this file since 98103 was 98103, checked in by vboxsync, 21 months ago

Copyright year updates by scm.

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