VirtualBox

source: vbox/trunk/src/VBox/Main/webservice/websrv-gsoapH.xsl@ 25877

Last change on this file since 25877 was 16122, checked in by vboxsync, 16 years ago

fixed webservice copyright

  • Property svn:eol-style set to native
File size: 36.1 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 websrv-gsoapH.xsl:
5 XSLT stylesheet that generates vboxweb_gsoapH.h from
6 the WSDL file previously generated from VirtualBox.xidl.
7 The gsoap.h "header" file can then be fed into gSOAP's
8 soapcpp2 to create web service client headers and server
9 stubs.
10
11 (The reason for this appears to be that gSOAP predates
12 WSDL and thus needed some format to describe the syntax
13 of a web service. gSOAP these days comes with wsdl2h,
14 which converts a WSDL file to gSOAP's "header" format,
15 but that has license problems and so we generate the
16 gSOAP "header" ourselves via XSLT.)
17
18 Copyright (C) 2006-2008 Sun Microsystems, Inc.
19
20 This file is part of VirtualBox Open Source Edition (OSE), as
21 available from http://www.virtualbox.org. This file is free software;
22 you can redistribute it and/or modify it under the terms of the GNU
23 General Public License (GPL) as published by the Free Software
24 Foundation, in version 2 as it comes in the "COPYING" file of the
25 VirtualBox OSE distribution. VirtualBox OSE is distributed in the
26 hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
27
28 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
29 Clara, CA 95054 USA or visit http://www.sun.com if you need
30 additional information or have any questions.
31-->
32
33<xsl:stylesheet
34 version="1.0"
35 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
36 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
37
38 <xsl:param name="G_argDebug" />
39
40 <xsl:output method="text"/>
41
42 <xsl:strip-space elements="*"/>
43
44<!-- - - - - - - - - - - - - - - - - - - - - - -
45 global XSLT variables
46 - - - - - - - - - - - - - - - - - - - - - - -->
47
48<xsl:variable name="G_xsltFilename" select="'websrv-gsoapH.xsl'" />
49
50<xsl:include href="websrv-shared.inc.xsl" />
51
52<!-- collect all interfaces with "wsmap='suppress'" in a global variable for
53 quick lookup -->
54<xsl:variable name="G_setSuppressedInterfaces"
55 select="//interface[@wsmap='suppress']" />
56
57<!--
58 emitConvertedType:
59 first type converter (from XIDL type to SOAP/C++ input types),
60 used for generating the argument lists with method implementation
61 headers.
62 -->
63<xsl:template name="emitConvertedType">
64 <xsl:param name="type" />
65
66 <xsl:choose>
67 <xsl:when test="$type='wstring'">std::string</xsl:when>
68 <xsl:when test="$type='boolean'">bool</xsl:when>
69 <xsl:when test="$type='double'">double</xsl:when>
70 <xsl:when test="$type='float'">float</xsl:when>
71 <!-- <xsl:when test="$type='octet'">byte</xsl:when> -->
72 <xsl:when test="$type='short'">short</xsl:when>
73 <xsl:when test="$type='unsigned short'">unsigned short</xsl:when>
74 <xsl:when test="$type='long'">long</xsl:when>
75 <xsl:when test="$type='long long'">long long</xsl:when>
76 <xsl:when test="$type='unsigned long'">unsigned long</xsl:when>
77 <xsl:when test="$type='unsigned long long'">unsigned long long</xsl:when>
78 <xsl:when test="$type='result'">unsigned long</xsl:when>
79 <xsl:when test="$type='uuid'">std::string</xsl:when>
80 <xsl:when test="$type='global'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
81 <xsl:when test="$type='managed'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
82 <xsl:when test="$type='explicit'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
83 <!-- not a standard type: then it better be one of the types defined in the XIDL -->
84 <xsl:when test="//enum[@name=$type]">
85 <xsl:value-of select="concat('enum vbox__', $type)" />
86 </xsl:when>
87 <xsl:when test="//collection[@name=$type]">
88 <xsl:value-of select="concat('vbox__ArrayOf', //collection[@name=$type]/@type, '*')" />
89 </xsl:when>
90 <xsl:when test="//interface[@name=$type]">
91 <!-- the type is one of our own interfaces: then it must have a wsmap attr -->
92 <xsl:variable name="wsmap" select="(//interface[@name=$type]/@wsmap) | (//collection[@name=$type]/@wsmap)" />
93 <xsl:choose>
94 <xsl:when test="$wsmap='global'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
95 <xsl:when test="$wsmap='managed'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
96 <xsl:when test="$wsmap='explicit'"><xsl:value-of select="$G_typeObjectRef_gsoapH" /></xsl:when>
97 <xsl:when test="$wsmap='struct'"><xsl:value-of select="concat('vbox__', $type, '*')" /></xsl:when>
98 </xsl:choose>
99 </xsl:when>
100 </xsl:choose>
101</xsl:template>
102
103<xsl:template name="convertTypeAndEmitPartOrElement">
104 <xsl:param name="ifname" />
105 <xsl:param name="methodname" />
106 <xsl:param name="name" />
107 <xsl:param name="type" />
108
109 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('....', $type, ' ', $name)" /></xsl:call-template>
110
111 <xsl:value-of select="concat(' ', '')"/>
112 <xsl:call-template name="emitConvertedType">
113 <xsl:with-param name="ifname" select="$ifname" />
114 <xsl:with-param name="methodname" select="$methodname" />
115 <xsl:with-param name="type" select="$type" />
116 </xsl:call-template>
117 <xsl:value-of select="concat(' ', $name, ' 1;')"/>
118 <xsl:call-template name="emitNewline" />
119</xsl:template>
120
121<xsl:template name="emitRequestArgs">
122 <xsl:param name="_ifname" /> <!-- interface name -->
123 <xsl:param name="_wsmap" /> <!-- interface's wsmap attribute -->
124 <xsl:param name="_methodname" />
125 <xsl:param name="_params" />
126 <xsl:param name="_valuetype" /> <!-- optional, for attribute setter messages -->
127
128 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $_ifname, '::', $_methodname, ': ', 'emitRequestArgs')" /></xsl:call-template>
129 <!-- first parameter will be object on which method is called, depending on wsmap attribute -->
130 <xsl:choose>
131 <xsl:when test="($_wsmap='managed') or ($_wsmap='explicit')">
132 <xsl:call-template name="convertTypeAndEmitPartOrElement">
133 <xsl:with-param name="ifname" select="$_ifname" />
134 <xsl:with-param name="methodname" select="$_methodname" />
135 <xsl:with-param name="name" select="$G_nameObjectRefEncoded" />
136 <xsl:with-param name="type" select="$_wsmap" />
137 </xsl:call-template>
138 </xsl:when>
139 </xsl:choose>
140 <!-- now for the real parameters, if any -->
141 <xsl:for-each select="$_params">
142 <!-- <xsl:value-of select="concat('// param &quot;', @name, '&quot;: direction &quot;', @dir, '&quot;')" />
143 <xsl:call-template name="emitNewline" /> -->
144 <!-- emit only parts for "in" parameters -->
145 <xsl:if test="@dir='in'">
146 <xsl:call-template name="convertTypeAndEmitPartOrElement">
147 <xsl:with-param name="ifname" select="$_ifname" />
148 <xsl:with-param name="methodname" select="$_methodname" />
149 <xsl:with-param name="name" select="@name" />
150 <xsl:with-param name="type" select="@type" />
151 </xsl:call-template>
152 </xsl:if>
153 </xsl:for-each>
154 <xsl:if test="$_valuetype">
155 <xsl:call-template name="convertTypeAndEmitPartOrElement">
156 <xsl:with-param name="ifname" select="$_ifname" />
157 <xsl:with-param name="methodname" select="$_methodname" />
158 <xsl:with-param name="name" select="@name" />
159 <xsl:with-param name="type" select="@type" />
160 </xsl:call-template>
161 </xsl:if>
162</xsl:template>
163
164<xsl:template name="emitResultArgs">
165 <xsl:param name="_ifname" />
166 <xsl:param name="_methodname" />
167 <xsl:param name="_params" /> <!-- set of parameter elements -->
168 <xsl:param name="_resulttype" /> <!-- for attribute getter methods only -->
169
170 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat('..', $_ifname, '::', $_methodname, ': ', 'emitResultArgs')" /></xsl:call-template>
171 <xsl:choose>
172 <xsl:when test="$_resulttype">
173 <xsl:call-template name="convertTypeAndEmitPartOrElement">
174 <xsl:with-param name="ifname" select="$_ifname" />
175 <xsl:with-param name="methodname" select="$_methodname" />
176 <xsl:with-param name="name" select="$G_result" />
177 <xsl:with-param name="type" select="$_resulttype" />
178 </xsl:call-template>
179 </xsl:when>
180 <xsl:otherwise>
181 <xsl:for-each select="$_params">
182 <!-- emit only parts for "out" parameters -->
183 <xsl:if test="@dir='out'">
184 <xsl:call-template name="convertTypeAndEmitPartOrElement">
185 <xsl:with-param name="ifname" select="$_ifname" />
186 <xsl:with-param name="methodname" select="$_methodname" />
187 <xsl:with-param name="name"><xsl:value-of select="@name" /></xsl:with-param>
188 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
189 </xsl:call-template>
190 </xsl:if>
191 <xsl:if test="@dir='return'">
192 <xsl:call-template name="convertTypeAndEmitPartOrElement">
193 <xsl:with-param name="ifname" select="$_ifname" />
194 <xsl:with-param name="methodname" select="$_methodname" />
195 <xsl:with-param name="name"><xsl:value-of select="$G_result" /></xsl:with-param>
196 <xsl:with-param name="type"><xsl:value-of select="@type" /></xsl:with-param>
197 </xsl:call-template>
198 </xsl:if>
199 </xsl:for-each>
200 </xsl:otherwise>
201 </xsl:choose>
202</xsl:template>
203
204
205<!-- - - - - - - - - - - - - - - - - - - - - - -
206 root match
207 - - - - - - - - - - - - - - - - - - - - - - -->
208
209<xsl:template match="/idl">
210 <xsl:text><![CDATA[
211/* DO NOT EDIT! This is a generated file.
212 * Generated from: src/VBox/Main/idl/VirtualBox.xidl (VirtualBox's interface definitions in XML)
213 * Generator: src/VBox/Main/webservice/websrv-gsoapH.xsl
214 *
215 * Note: This is not a real C/C++ header file. Instead, gSOAP uses files like this
216 * one -- with a pseudo-C-header syntax -- to describe a web service API.
217 */
218
219// STL vector containers
220#import "stlvector.h"
221
222]]></xsl:text>
223
224 <xsl:value-of select="concat('//gsoap vbox schema namespace: ', $G_targetNamespace)" />
225 <xsl:value-of select="concat('//gsoap vbox schema form: unqualified', '')" />
226
227 <xsl:apply-templates />
228</xsl:template>
229
230<!-- - - - - - - - - - - - - - - - - - - - - - -
231 if
232 - - - - - - - - - - - - - - - - - - - - - - -->
233
234<!--
235 * ignore all |if|s except those for WSDL target
236-->
237<xsl:template match="if">
238 <xsl:if test="@target='wsdl'">
239 <xsl:apply-templates/>
240 </xsl:if>
241</xsl:template>
242
243<!-- - - - - - - - - - - - - - - - - - - - - - -
244 cpp
245 - - - - - - - - - - - - - - - - - - - - - - -->
246
247<xsl:template match="cpp">
248<!-- ignore this -->
249</xsl:template>
250
251<!-- - - - - - - - - - - - - - - - - - - - - - -
252 library
253 - - - - - - - - - - - - - - - - - - - - - - -->
254
255<xsl:template match="library">
256 <xsl:text>
257/****************************************************************************
258 *
259 * forward declarations
260 *
261 ****************************************************************************/
262</xsl:text>
263
264 <xsl:call-template name="emitNewline" />
265 <xsl:text>// *** interfaces with wsmap="struct"</xsl:text>
266 <xsl:call-template name="emitNewline" />
267
268 <xsl:for-each select="//interface[@wsmap='struct']">
269 <xsl:value-of select="concat('class vbox__', @name, ';')" />
270 <xsl:call-template name="emitNewline" />
271 </xsl:for-each>
272
273 <xsl:call-template name="emitNewline" />
274 <xsl:text>// *** collections</xsl:text>
275 <xsl:call-template name="emitNewline" />
276
277 <xsl:for-each select="//collection">
278 <xsl:value-of select="concat('class vbox__ArrayOf', @type, ';')" />
279 <xsl:call-template name="emitNewline" />
280 </xsl:for-each>
281
282 <xsl:if test="$G_basefmt='document'">
283 <xsl:call-template name="emitNewline" />
284 <xsl:text>// elements for message arguments (parts)</xsl:text>
285 <xsl:call-template name="emitNewline" />
286
287 <xsl:for-each select="//interface">
288 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
289 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
290
291 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
292 <xsl:value-of select="concat('// Interface ', $ifname)" />
293 <xsl:call-template name="emitNewline" />
294
295 <xsl:for-each select="attribute">
296 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
297 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
298 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
299 <xsl:choose>
300 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
301 <xsl:value-of select="concat('// skipping attribute ', $attrtype, ' for it is of a suppressed type')" />
302 <xsl:call-template name="emitNewline" />
303 </xsl:when>
304 <xsl:otherwise>
305 <xsl:choose>
306 <xsl:when test="@readonly='yes'">
307 <xsl:value-of select="concat('// readonly attribute ', $ifname, '::', $attrname)" />
308 </xsl:when>
309 <xsl:otherwise>
310 <xsl:value-of select="concat('// read/write attribute ', $ifname, '::', $attrname)" />
311 </xsl:otherwise>
312 </xsl:choose>
313 <xsl:call-template name="emitNewline" />
314 <!-- aa) emit getter -->
315 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
316 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrGetter, $G_requestMessageElementSuffix, ';')" />
317 <xsl:call-template name="emitNewline" />
318 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrGetter, $G_responseMessageElementSuffix, ';')" />
319 <xsl:call-template name="emitNewline" />
320 <!-- bb) emit setter if the attribute is read/write -->
321 <xsl:if test="not($attrreadonly='yes')">
322 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
323 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrSetter, $G_requestMessageElementSuffix, ';')" />
324 <xsl:call-template name="emitNewline" />
325 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrSetter, $G_responseMessageElementSuffix, ';')" />
326 <xsl:call-template name="emitNewline" />
327 </xsl:if>
328 </xsl:otherwise>
329 </xsl:choose>
330 </xsl:for-each> <!-- select="attribute" -->
331 <xsl:for-each select="method">
332 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
333 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
334 <xsl:choose>
335 <xsl:when test="param[@type=($G_setSuppressedInterfaces/@name)]">
336 <xsl:value-of select="concat('// skipping method ', $ifname, '::', $methodname, ' for it has parameters with suppressed types')" />
337 <xsl:call-template name="emitNewline" />
338 </xsl:when>
339 <xsl:otherwise>
340 <xsl:value-of select="concat('// method ', $ifname, '::', $methodname)" />
341 <xsl:call-template name="emitNewline" />
342 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix, ';')" />
343 <xsl:call-template name="emitNewline" />
344 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix, ';')" />
345 <xsl:call-template name="emitNewline" />
346 </xsl:otherwise>
347 </xsl:choose>
348 </xsl:for-each>
349 </xsl:if>
350 </xsl:for-each>
351 </xsl:if> <!-- document style -->
352
353 <xsl:text>
354/****************************************************************************
355 *
356 * faults
357 *
358 ****************************************************************************/
359 </xsl:text>
360
361 <xsl:text>
362class _vbox__InvalidObjectFault
363{ public:
364 std::string badObjectID 1;
365 struct soap *soap;
366};
367
368class _vbox__RuntimeFault
369{ public:
370 long resultCode 1;
371 std::string interfaceID 1;
372 std::string component 1;
373 std::string text 1;
374 struct soap *soap;
375};
376
377struct SOAP_ENV__Detail
378{
379 _vbox__InvalidObjectFault *vbox__InvalidObjectFault;
380 _vbox__RuntimeFault *vbox__RuntimeFault;
381 int __type;
382 void *fault;
383 _XML __any;
384};</xsl:text>
385 <xsl:call-template name="emitNewline" />
386
387 <xsl:text>
388/****************************************************************************
389 *
390 * enums
391 *
392 ****************************************************************************/
393</xsl:text>
394
395 <xsl:for-each select="//enum">
396 <xsl:call-template name="emitNewline" />
397 <xsl:variable name="enumname" select="@name" />
398 <xsl:value-of select="concat('enum vbox__', $enumname)" />
399 <xsl:call-template name="emitNewline" />
400 <xsl:text>{</xsl:text>
401 <xsl:call-template name="emitNewline" />
402 <xsl:for-each select="const">
403 <xsl:if test="position() > 1">
404 <xsl:text>,</xsl:text>
405 <xsl:call-template name="emitNewline" />
406 </xsl:if>
407 <xsl:value-of select="concat(' vbox__', $enumname, '__')" />
408 <!-- escape all "_" in @name -->
409 <xsl:call-template name="escapeUnderscores">
410 <xsl:with-param name="string" select="@name" />
411 </xsl:call-template>
412 </xsl:for-each>
413 <xsl:call-template name="emitNewline" />
414 <xsl:text>};</xsl:text>
415 <xsl:call-template name="emitNewline" />
416 </xsl:for-each>
417
418 <xsl:text>
419/****************************************************************************
420 *
421 * structs
422 *
423 ****************************************************************************/
424</xsl:text>
425
426 <xsl:for-each select="//interface[@wsmap='struct']">
427 <xsl:call-template name="emitNewline" />
428 <xsl:value-of select="concat('// interface ', @name, ' as struct: ')" />
429 <xsl:call-template name="emitNewline" />
430
431 <xsl:value-of select="concat('class vbox__', @name)" />
432 <xsl:call-template name="emitNewline" />
433 <xsl:text>{ public:</xsl:text>
434 <xsl:call-template name="emitNewline" />
435
436 <xsl:for-each select="attribute">
437 <xsl:text> </xsl:text>
438 <xsl:call-template name="emitConvertedType"><xsl:with-param name="type" select="@type" /></xsl:call-template>
439 <xsl:value-of select="concat(' ', @name, ' 1;')" />
440 <xsl:call-template name="emitNewline" />
441 </xsl:for-each>
442
443 <xsl:text> struct soap *soap;</xsl:text>
444 <xsl:call-template name="emitNewline" />
445 <xsl:text>};</xsl:text>
446 <xsl:call-template name="emitNewline" />
447 </xsl:for-each>
448
449 <xsl:text>
450/****************************************************************************
451 *
452 * arrays
453 *
454 ****************************************************************************/
455</xsl:text>
456
457 <xsl:for-each select="//collection">
458 <xsl:call-template name="emitNewline" />
459 <xsl:value-of select="concat('class vbox__ArrayOf', @type)" />
460 <xsl:call-template name="emitNewline" />
461 <xsl:text>{ public:</xsl:text>
462 <xsl:call-template name="emitNewline" />
463 <xsl:text> std::vector&lt;</xsl:text>
464 <xsl:call-template name="emitConvertedType"><xsl:with-param name="type" select="@type" /></xsl:call-template>
465 <xsl:text>&gt; array 0;</xsl:text>
466 <xsl:call-template name="emitNewline" />
467
468 <xsl:text> struct soap *soap;</xsl:text>
469 <xsl:call-template name="emitNewline" />
470 <xsl:text>};</xsl:text>
471 <xsl:call-template name="emitNewline" />
472 </xsl:for-each>
473
474
475 <xsl:if test="$G_basefmt='document'">
476 <xsl:text>
477/****************************************************************************
478 *
479 * elements for message arguments (parts); generated for WSDL 'document' style
480 *
481 ****************************************************************************/
482
483</xsl:text>
484
485 <xsl:for-each select="//interface">
486 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
487 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
488
489 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
490 <xsl:call-template name="emitNewline" />
491 <xsl:value-of select="concat('// Interface ', $ifname)" />
492 <xsl:call-template name="emitNewline" />
493
494 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat($ifname, ' interface: ', 'all attributes')" /></xsl:call-template>
495 <xsl:for-each select="attribute">
496 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
497 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
498 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
499 <xsl:call-template name="emitNewline" />
500 <xsl:choose>
501 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
502 <xsl:value-of select="concat('// skipping attribute ', $attrtype, ' for it is of a suppressed type')" />
503 <xsl:call-template name="emitNewline" />
504 </xsl:when>
505 <xsl:otherwise>
506 <xsl:choose>
507 <xsl:when test="@readonly='yes'">
508 <xsl:value-of select="concat('// readonly attribute ', $ifname, '::', $attrname)" />
509 </xsl:when>
510 <xsl:otherwise>
511 <xsl:value-of select="concat('// read/write attribute ', $ifname, '::', $attrname)" />
512 </xsl:otherwise>
513 </xsl:choose>
514 <xsl:call-template name="emitNewline" />
515 <!-- aa) emit getter -->
516 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
517 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrGetter, $G_requestMessageElementSuffix)" />
518 <xsl:call-template name="emitNewline" />
519 <xsl:text>{ public:</xsl:text>
520 <xsl:call-template name="emitNewline" />
521 <xsl:call-template name="emitRequestArgs">
522 <xsl:with-param name="_ifname" select="$ifname" />
523 <xsl:with-param name="_wsmap" select="$wsmap" />
524 <xsl:with-param name="_methodname" select="$attrGetter" />
525 <xsl:with-param name="_params" select="/.." />
526 <!-- <xsl:with-param name="_valuetype" select="$attrtype" /> -->
527 </xsl:call-template>
528 <xsl:text> struct soap *soap;</xsl:text>
529 <xsl:call-template name="emitNewline" />
530 <xsl:text>};</xsl:text>
531 <xsl:call-template name="emitNewline" />
532
533 <xsl:call-template name="emitNewline" />
534 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrGetter, $G_responseMessageElementSuffix)" />
535 <xsl:call-template name="emitNewline" />
536 <xsl:text>{ public:</xsl:text>
537 <xsl:call-template name="emitNewline" />
538 <xsl:call-template name="emitResultArgs">
539 <xsl:with-param name="_ifname" select="$ifname" />
540 <xsl:with-param name="_methodname" select="$attrGetter" />
541 <xsl:with-param name="_params" select="/.." />
542 <xsl:with-param name="_resulttype" select="$attrtype" />
543 </xsl:call-template>
544 <xsl:text> struct soap *soap;</xsl:text>
545 <xsl:call-template name="emitNewline" />
546 <xsl:text>};</xsl:text>
547 <xsl:call-template name="emitNewline" />
548 <!-- bb) emit setter if the attribute is read/write -->
549 <xsl:if test="not($attrreadonly='yes')">
550 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
551 <xsl:call-template name="emitNewline" />
552 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrSetter, $G_requestMessageElementSuffix)" />
553 <xsl:call-template name="emitNewline" />
554 <xsl:text>{ public:</xsl:text>
555 <xsl:call-template name="emitRequestArgs">
556 <xsl:with-param name="_ifname" select="$ifname" />
557 <xsl:with-param name="_wsmap" select="$wsmap" />
558 <xsl:with-param name="_methodname" select="$attrSetter" />
559 <xsl:with-param name="_params" select="/.." />
560 <xsl:with-param name="_valuetype" select="$attrtype" />
561 </xsl:call-template>
562 <xsl:call-template name="emitNewline" />
563 <xsl:text> struct soap *soap;</xsl:text>
564 <xsl:call-template name="emitNewline" />
565 <xsl:text>};</xsl:text>
566 <xsl:call-template name="emitNewline" />
567 <xsl:call-template name="emitNewline" />
568 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $attrSetter, $G_responseMessageElementSuffix)" />
569 <xsl:call-template name="emitNewline" />
570 <xsl:text>{ public:</xsl:text>
571 <xsl:call-template name="emitNewline" />
572 <xsl:call-template name="emitResultArgs">
573 <xsl:with-param name="_ifname" select="$ifname" />
574 <xsl:with-param name="_methodname" select="$attrSetter" />
575 <xsl:with-param name="_params" select="/.." />
576 </xsl:call-template>
577 <xsl:text> struct soap *soap;</xsl:text>
578 <xsl:call-template name="emitNewline" />
579 <xsl:text>};</xsl:text>
580 <xsl:call-template name="emitNewline" />
581 </xsl:if>
582 </xsl:otherwise>
583 </xsl:choose>
584 </xsl:for-each> <!-- select="attribute" -->
585
586 <xsl:call-template name="debugMsg"><xsl:with-param name="msg" select="concat($ifname, ' interface: ', 'all methods')" /></xsl:call-template>
587 <xsl:for-each select="method">
588 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
589 <xsl:call-template name="emitNewline" />
590 <!-- skip this method if it has parameters of a type that has wsmap="suppress" -->
591 <xsl:choose>
592 <xsl:when test="param[@type=($G_setSuppressedInterfaces/@name)]">
593 <xsl:value-of select="concat('// skipping method ', $ifname, '::', $methodname, ' for it has parameters with suppressed types')" />
594 <xsl:call-template name="emitNewline" />
595 </xsl:when>
596 <xsl:otherwise>
597 <xsl:value-of select="concat('// method ', $ifname, '::', $methodname)" />
598 <xsl:call-template name="emitNewline" />
599 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix)" />
600 <xsl:call-template name="emitNewline" />
601 <xsl:text>{ public:</xsl:text>
602 <xsl:call-template name="emitNewline" />
603 <xsl:call-template name="emitRequestArgs">
604 <xsl:with-param name="_ifname" select="$ifname" />
605 <xsl:with-param name="_wsmap" select="$wsmap" />
606 <xsl:with-param name="_methodname" select="$methodname" />
607 <xsl:with-param name="_params" select="param" />
608 </xsl:call-template>
609 <xsl:text> struct soap *soap;</xsl:text>
610 <xsl:call-template name="emitNewline" />
611 <xsl:text>};</xsl:text>
612 <xsl:call-template name="emitNewline" />
613 <!-- <xsl:if test="(count(param[@dir='out'] | param[@dir='return']) > 0)"> -->
614 <xsl:call-template name="emitNewline" />
615 <xsl:value-of select="concat('class _vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix)" />
616 <xsl:call-template name="emitNewline" />
617 <xsl:text>{ public:</xsl:text>
618 <xsl:call-template name="emitNewline" />
619 <xsl:call-template name="emitResultArgs">
620 <xsl:with-param name="_ifname" select="$ifname" />
621 <xsl:with-param name="_wsmap" select="$wsmap" />
622 <xsl:with-param name="_methodname" select="$methodname" />
623 <xsl:with-param name="_params" select="param" />
624 </xsl:call-template>
625 <xsl:text> struct soap *soap;</xsl:text>
626 <xsl:call-template name="emitNewline" />
627 <xsl:text>};</xsl:text>
628 <xsl:call-template name="emitNewline" />
629 <!-- </xsl:if> -->
630 </xsl:otherwise>
631 </xsl:choose>
632 </xsl:for-each>
633 </xsl:if>
634 </xsl:for-each> <!-- interface (element declarations -->
635
636 <xsl:text>
637/****************************************************************************
638 *
639 * service descriptions
640 *
641 ****************************************************************************/
642
643</xsl:text>
644
645 <xsl:value-of select="concat('//gsoap vbox service name: vbox', $G_bindingSuffix)" />
646 <xsl:call-template name="emitNewline" />
647 <xsl:value-of select="concat('//gsoap vbox service type: vbox', $G_portTypeSuffix)" />
648 <xsl:call-template name="emitNewline" />
649 <xsl:value-of select="concat('//gsoap vbox service namespace: ', $G_targetNamespace, $G_targetNamespaceSeparator)" />
650 <xsl:call-template name="emitNewline" />
651 <xsl:value-of select="concat('//gsoap vbox service transport: ', 'http://schemas.xmlsoap.org/soap/http')" />
652 <xsl:call-template name="emitNewline" />
653
654 </xsl:if> <!-- document style -->
655
656 <xsl:apply-templates />
657
658</xsl:template>
659
660<!-- - - - - - - - - - - - - - - - - - - - - - -
661 class
662 - - - - - - - - - - - - - - - - - - - - - - -->
663
664<xsl:template match="module/class">
665<!-- swallow -->
666</xsl:template>
667
668<!-- - - - - - - - - - - - - - - - - - - - - - -
669 enum
670 - - - - - - - - - - - - - - - - - - - - - - -->
671
672<xsl:template match="enum">
673</xsl:template>
674
675<!-- - - - - - - - - - - - - - - - - - - - - - -
676 const
677 - - - - - - - - - - - - - - - - - - - - - - -->
678
679<!--
680<xsl:template match="const">
681 <xsl:apply-templates />
682</xsl:template>
683-->
684
685<!-- - - - - - - - - - - - - - - - - - - - - - -
686 desc
687 - - - - - - - - - - - - - - - - - - - - - - -->
688
689<xsl:template match="desc">
690<!-- swallow -->
691</xsl:template>
692
693<!-- - - - - - - - - - - - - - - - - - - - - - -
694 note
695 - - - - - - - - - - - - - - - - - - - - - - -->
696
697<xsl:template match="note">
698 <xsl:apply-templates />
699</xsl:template>
700
701<xsl:template name="emitMethod">
702 <xsl:param name="ifname" />
703 <xsl:param name="methodname" />
704 <xsl:param name="fOutParams" />
705
706 <xsl:variable name="methodname2" select="concat($ifname, '_USCORE', $methodname)" />
707
708 <xsl:call-template name="emitNewline" />
709 <xsl:value-of select="concat('//gsoap vbox service method-style: ', $methodname2, ' ', $G_basefmt)" />
710 <xsl:call-template name="emitNewline" />
711 <xsl:value-of select="concat('//gsoap vbox service method-encoding: ', $methodname2, ' ', $G_parmfmt)" />
712 <xsl:call-template name="emitNewline" />
713 <xsl:value-of select="concat('//gsoap vbox service method-action: ', $methodname2, ' &quot;&quot;')" />
714 <xsl:call-template name="emitNewline" />
715 <xsl:value-of select="concat('//gsoap vbox service method-fault: ', $methodname2, ' vbox__InvalidObjectFault')" />
716 <xsl:call-template name="emitNewline" />
717 <xsl:value-of select="concat('//gsoap vbox service method-fault: ', $methodname2, ' vbox__RuntimeFault')" />
718 <xsl:call-template name="emitNewline" />
719 <xsl:value-of select="concat('int __vbox__', $methodname2, '(')" />
720 <xsl:call-template name="emitNewline" />
721 <xsl:value-of select="concat(' _vbox__', $methodname2, $G_requestMessageElementSuffix, '* vbox__', $ifname, '_USCORE', $methodname, $G_requestMessageElementSuffix)" />
722 <xsl:if test="$fOutParams">
723 <xsl:text>,</xsl:text>
724 <xsl:call-template name="emitNewline" />
725 <xsl:value-of select="concat(' _vbox__', $methodname2, $G_responseMessageElementSuffix, '* vbox__', $ifname, '_USCORE', $methodname, $G_responseMessageElementSuffix)" />
726 </xsl:if>
727 <xsl:call-template name="emitNewline" />
728 <xsl:text>);</xsl:text>
729 <xsl:call-template name="emitNewline" />
730
731</xsl:template>
732
733<!-- - - - - - - - - - - - - - - - - - - - - - -
734 interface
735 - - - - - - - - - - - - - - - - - - - - - - -->
736
737<xsl:template match="interface">
738 <!-- remember the interface name in local variables -->
739 <xsl:variable name="ifname"><xsl:value-of select="@name" /></xsl:variable>
740 <xsl:variable name="wsmap"><xsl:value-of select="@wsmap" /></xsl:variable>
741
742 <!-- we can save ourselves verifying the interface here as it's already
743 done in the WSDL converter -->
744
745 <xsl:if test='not( ($wsmap="suppress") or ($wsmap="struct") )'>
746 <xsl:text>
747/****************************************************************************
748 *
749 * interface </xsl:text>
750<xsl:value-of select="$ifname" />
751<xsl:text>
752 *
753 ****************************************************************************/
754</xsl:text>
755
756 <!--
757 here come the attributes
758 -->
759 <xsl:for-each select="attribute">
760 <xsl:variable name="attrname"><xsl:value-of select="@name" /></xsl:variable>
761 <xsl:variable name="attrtype"><xsl:value-of select="@type" /></xsl:variable>
762 <xsl:variable name="attrreadonly"><xsl:value-of select="@readonly" /></xsl:variable>
763 <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>
764 <!-- skip this attribute if it has parameters of a type that has wsmap="suppress" -->
765 <xsl:choose>
766 <xsl:when test="( $attrtype=($G_setSuppressedInterfaces/@name) )">
767 <xsl:comment><xsl:value-of select="concat('skipping attribute ', $attrtype, ' for it is of a suppressed type')" /></xsl:comment>
768 </xsl:when>
769 <xsl:otherwise>
770 <xsl:choose>
771 <xsl:when test="@readonly='yes'">
772 <xsl:comment> readonly attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
773 </xsl:when>
774 <xsl:otherwise>
775 <xsl:comment> read/write attribute <xsl:copy-of select="$ifname" />::<xsl:copy-of select="$attrname" /> </xsl:comment>
776 </xsl:otherwise>
777 </xsl:choose>
778 <!-- aa) get method: emit request and result -->
779 <xsl:variable name="attrGetter"><xsl:call-template name="makeGetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
780 <xsl:call-template name="emitMethod">
781 <xsl:with-param name="ifname" select="$ifname" />
782 <xsl:with-param name="methodname" select="$attrGetter" />
783 <xsl:with-param name="fOutParams" select="1" />
784 </xsl:call-template>
785 <!-- bb) emit a set method if the attribute is read/write -->
786 <xsl:if test="not($attrreadonly='yes')">
787 <xsl:variable name="attrSetter"><xsl:call-template name="makeSetterName"><xsl:with-param name="attrname" select="$attrname" /></xsl:call-template></xsl:variable>
788 <xsl:call-template name="emitMethod">
789 <xsl:with-param name="ifname" select="$ifname" />
790 <xsl:with-param name="methodname" select="$attrSetter" />
791 <xsl:with-param name="fOutParams" select="1" />
792 </xsl:call-template>
793 </xsl:if>
794 </xsl:otherwise>
795 </xsl:choose>
796 </xsl:for-each> <!-- select="attribute" -->
797
798 <!--
799 here come the real methods
800 -->
801
802 <xsl:for-each select="method">
803 <xsl:variable name="methodname"><xsl:value-of select="@name" /></xsl:variable>
804
805 <xsl:choose>
806 <xsl:when test="param[@type=($G_setSuppressedInterfaces/@name)]">
807 <xsl:comment><xsl:value-of select="concat('skipping method ', $methodname, ' for it has parameters with suppressed types')" /></xsl:comment>
808 </xsl:when>
809 <xsl:otherwise>
810 <xsl:call-template name="emitMethod">
811 <xsl:with-param name="ifname" select="$ifname" />
812 <xsl:with-param name="methodname" select="$methodname" />
813 <xsl:with-param name="fOutParams" select="1" /> <!-- (count(param[@dir='out'] | param[@dir='return']) > 0)" /> -->
814 </xsl:call-template>
815 </xsl:otherwise>
816 </xsl:choose>
817 </xsl:for-each>
818 </xsl:if>
819
820</xsl:template>
821
822</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