Skip to content

Commit 69a0c7b

Browse files
committed
Merge branch 'po/wsdl-ref' into 'master'
WSDL enhancement for element ref support and support for new xsd See merge request eng/toolchain/aws!40
2 parents f640254 + 231092c commit 69a0c7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+5339
-414
lines changed

docs/source/using_wsdl.rst

Lines changed: 86 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ document. In this section we describe the mapping between Ada and
167167
Mapped to **xsd:double**, not supported by SOAP, mapped
168168
for convenience but precision cannot be guaranteed.
169169

170+
*SOAP.Types.Decimal*
171+
Mapped to **xsd:decimal**
172+
170173
*Boolean*
171174
Mapped to **xsd:boolean**
172175

@@ -177,20 +180,35 @@ document. In this section we describe the mapping between Ada and
177180
Mapped to **xsd:string**, note that Unbounded_String should be used
178181
only inside a record for full interoperability. This is a current limitation.
179182

183+
*SOAP.Types.Normalized_String*
184+
Mapped to **xsd:normalizedString**
185+
186+
*SOAP.Types.Token*
187+
Mapped to **xsd:token**
188+
189+
*SOAP.Types.Any_URI*
190+
Mapped to **xsd:anyURI**
191+
180192
.. highlight:: xml
181193

182194
*Character*
183195
Mapped to a Character schema definition::
184196

185-
<simpleType name="Character">
186-
<restriction base="xsd:string">
187-
<length value="1"/>
188-
</restriction>
189-
</simpleType>
197+
<xsd:simpleType name="Character">
198+
<xsd:restriction base="xsd:string">
199+
<xsd:length value="1"/>
200+
</xsd:restriction>
201+
</xsd:simpleType>
190202

191-
*Ada.Calendar.Time*
203+
*Ada.Calendar.Time* and *SOAP.Types.Local_Date_Time*
192204
Mapped to **xsd:dateTime**
193205

206+
*SOAP.Types.Local_Date*
207+
Mapped to **xsd:date**
208+
209+
*SOAP.Types.Local_Time*
210+
Mapped to **xsd:time**
211+
194212
*Duration*
195213
Mapped to **xsd:duration**
196214

@@ -238,9 +256,9 @@ document. In this section we describe the mapping between Ada and
238256

239257
is defined as::
240258

241-
<simpleType name="Number" targetNamespace="http://soapaws/WSDL_C_pkg/">
242-
<restriction base="xsd:int"/>
243-
</simpleType>
259+
<xsd:simpleType name="Number" targetNamespace="http://soapaws/WSDL_C_pkg/">
260+
<xsd:restriction base="xsd:int"/>
261+
</xsd:simpleType>
244262

245263
.. highlight:: ada
246264

@@ -254,12 +272,12 @@ document. In this section we describe the mapping between Ada and
254272

255273
is defined as::
256274

257-
<simpleType name="Number" targetNamespace="http://soapaws/WSDL_C_pkg/">
258-
<restriction base="xsd:int">
275+
<xsd:simpleType name="Number" targetNamespace="http://soapaws/WSDL_C_pkg/">
276+
<xsd:restriction base="xsd:int">
259277
<xsd:minInclusive value=" 1"/>
260278
<xsd:maxInclusive value=" 9345"/>
261-
</restriction>
262-
</simpleType>
279+
</xsd:restriction>
280+
</xsd:simpleType>
263281

264282
Or for a string::
265283

@@ -271,11 +289,11 @@ document. In this section we describe the mapping between Ada and
271289

272290
is defined as::
273291

274-
<simpleType name="Code" targetNamespace="http://soapaws/WSDL_C_pkg/">
292+
<xsd:simpleType name="Code" targetNamespace="http://soapaws/WSDL_C_pkg/">
275293
<xsd:restriction base="xsd:string">
276294
<xsd:Length value="10"/>
277295
</xsd:restriction>
278-
</simpleType>
296+
</xsd:simpleType>
279297

280298
.. highlight:: ada
281299

@@ -289,12 +307,12 @@ document. In this section we describe the mapping between Ada and
289307

290308
is defined as::
291309

292-
<simpleType name="Small" targetNamespace="http://soapaws/WSDL_C_pkg/">
293-
<restriction base="xsd:byte">
310+
<xsd:simpleType name="Small" targetNamespace="http://soapaws/WSDL_C_pkg/">
311+
<xsd:restriction base="xsd:byte">
294312
<xsd:minInclusive value=" 1"/>
295313
<xsd:maxInclusive value=" 10"/>
296-
</restriction>
297-
</simpleType>
314+
</xsd:restriction>
315+
</xsd:simpleType>
298316

299317
.. highlight:: ada
300318

@@ -307,11 +325,29 @@ document. In this section we describe the mapping between Ada and
307325

308326
is defined as::
309327

310-
<simpleType name="Count" targetNamespace="http://soapaws/WSDL_C_pkg/">
328+
<xsd:simpleType name="Count" targetNamespace="http://soapaws/WSDL_C_pkg/">
311329
<xsd:restriction base="xsd:unsignedByte">
312330
<xsd:maxInclusive value=" 13"/>
313331
</xsd:restriction>
314-
</simpleType>
332+
</xsd:simpleType>
333+
334+
.. highlight:: ada
335+
336+
*Decimal types*
337+
Mapped to a decimal with possible range constraints::
338+
339+
type Price is delta 0.01 digits 12 range 0.0 .. 1234.1;
340+
341+
.. highlight:: xml
342+
343+
is defined as::
344+
345+
<xsd:simpleType name="Price">
346+
<xsd:restriction base="xsd:decimal">
347+
<xsd:minInclusive value=" 0.00000000"/>
348+
<xsd:maxInclusive value=" 1234.10000000"/>
349+
</xsd:restriction>
350+
</xsd:simpleType>
315351

316352
.. highlight:: ada
317353

@@ -324,13 +360,13 @@ document. In this section we describe the mapping between Ada and
324360

325361
is defined as::
326362

327-
<simpleType name="Color">
328-
<restriction base="xsd:string">
329-
<enumeration value="Red"/>
330-
<enumeration value="Green"/>
331-
<enumeration value="Blue"/>
332-
</restriction>
333-
</simpleType>
363+
<xsd:simpleType name="Color">
364+
<xsd:restriction base="xsd:string">
365+
<xsd:enumeration value="Red"/>
366+
<xsd:enumeration value="Green"/>
367+
<xsd:enumeration value="Blue"/>
368+
</xsd:restriction>
369+
</xsd:simpleType>
334370

335371
.. highlight:: ada
336372

@@ -350,16 +386,16 @@ document. In this section we describe the mapping between Ada and
350386

351387
is defined as::
352388

353-
<complexType name="Rec">
354-
<all>
355-
<element name="A" type="xsd:int"/>
356-
<element name="B" type="xsd:float"/>
357-
<element name="C" type="xsd:double"/>
358-
<element name="D" type="tns:Character"/>
359-
<element name="E" type="xsd:string"/>
360-
<element name="F" type="xsd:boolean"/>
361-
</all>
362-
</complexType>
389+
<xsd:complexType name="Rec">
390+
<xsd:all>
391+
<xsd:element name="A" type="xsd:int"/>
392+
<xsd:element name="B" type="xsd:float"/>
393+
<xsd:element name="C" type="xsd:double"/>
394+
<xsd:element name="D" type="tns:Character"/>
395+
<xsd:element name="E" type="xsd:string"/>
396+
<xsd:element name="F" type="xsd:boolean"/>
397+
</xsd:all>
398+
</xsd:complexType>
363399

364400
.. highlight:: ada
365401

@@ -381,13 +417,13 @@ document. In this section we describe the mapping between Ada and
381417

382418
A SOAP encoded format can be generated with the -sea option:
383419

384-
<complexType name="Set_Of_Rec">
385-
<complexContent>
386-
<restriction base="soap-enc:Array">
387-
<attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:Rec[]"/>
388-
</restriction>
389-
</complexContent>
390-
</complexType>
420+
<xsd:complexType name="Set_Of_Rec">
421+
<xsd:complexContent>
422+
<xsd:restriction base="soap-enc:Array">
423+
<xsd:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:Rec[]"/>
424+
</xsd:restriction>
425+
</xsd:complexContent>
426+
</xsd:complexType>
391427

392428
.. highlight:: ada
393429

@@ -482,11 +518,11 @@ document. In this section we describe the mapping between Ada and
482518
</xsd:sequence>
483519
</xsd:complexType>
484520

485-
<complexType name="Complex_Rec">
486-
<all>
487-
<element name="SI" type="tns:Set_Of_Int"/>
488-
</all>
489-
</complexType>
521+
<xsd:complexType name="Complex_Rec">
522+
<xsd:all>
523+
<xsd:element name="SI" type="tns:Set_Of_Int"/>
524+
</xsd:all>
525+
</xsd:complexType>
490526

491527
.. highlight:: ada
492528

regtests/0249_wsdl_extension/test.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Procedure ServerExit SOAPAction:
77
[record] ServerExit ; ServerExit
88
[set] {0 .. unbounded} fieldsToNull ; string_Set [string]
99
[simple] Id ; String
10-
[set] {0 .. 1} CreatedBy ; string_Set [string]
10+
[simple] {0 .. 1} CreatedBy ; String
1111
Output
1212
[record] Response ; Response
1313
[simple] ErrorCode ; Integer

regtests/0260_wsdl-ext-schema/test.out

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ Procedure wsGetSrvRequest SOAPAction:
55
Input
66
[record] wsGetSrvRequest ; WsGetSrvRequest
77
[simple] limits ; Integer
8-
[set] {0 .. 1} spatialDomain ; WsSpatialDomain_Set [WsSpatialDomain]
8+
[set] {0 .. 1} spatialDomain ; WsSpatialDomain
9+
[record] southWestCorner ; WsLatLongDegrees
10+
[derived] latitudeDegrees ; WsLatitudeDegrees
11+
[derived] longitudeDegrees ; WsLongitudeDegrees
12+
[derived] northEastCorner ; WsLongitudeDegrees
913

1014
Output
1115
[record] results ; WsGetSrvResults
12-
[set] {0 .. 1} bestA ; float_Set [float]
13-
[set] {0 .. 1} bestB ; float_Set [float]
16+
[simple] {0 .. 1} bestA ; Float
17+
[simple] {0 .. 1} bestB ; Float
1418
> wsGetSrvRequest

regtests/0274_doclit2/dl2_server_cb.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ package body Dl2_Server_CB is
4444
return getQueueStatus_Result;
4545

4646
function execute
47-
(executionTime : SOAP.Types.Local_Time;
47+
(executionTime : SOAP.Types.Local_Date_Time;
4848
valueA : RecB_Set_Type)
4949
return String;
5050

@@ -82,7 +82,7 @@ package body Dl2_Server_CB is
8282
-------------
8383

8484
function execute
85-
(executionTime : SOAP.Types.Local_Time;
85+
(executionTime : SOAP.Types.Local_Date_Time;
8686
valueA : RecB_Set_Type)
8787
return String is
8888
begin

regtests/0331_relative_xsd/dl2_server_cb.adb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ package body Dl2_Server_CB is
4444
return getQueueStatus_Result;
4545

4646
function execute
47-
(executionTime : SOAP.Types.Local_Time;
47+
(executionTime : SOAP.Types.Local_Date_Time;
4848
valueA : RecB_Set_Type)
4949
return String;
5050

@@ -82,7 +82,7 @@ package body Dl2_Server_CB is
8282
-------------
8383

8484
function execute
85-
(executionTime : SOAP.Types.Local_Time;
85+
(executionTime : SOAP.Types.Local_Date_Time;
8686
valueA : RecB_Set_Type)
8787
return String is
8888
begin
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!lal DEAD
2+
!xmlada DEAD
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
0.00000000
2+
12.00000000
3+
12.10000000
4+
12.20000000
5+
12.35000000
6+
98712.00000000
7+
789.00000000
8+
-2.00000000
9+
88.00000000
10+
12.99
11+
0.00001000
12+
0.00012000
13+
0.00123000
14+
0.01234000
15+
0.12345000
16+
1.23456000
17+
12.34567000
18+
123.45678000
19+
1234.56789000
20+
12345.67900000
21+
123456.79011000
22+
1234567.90122000
23+
12345679.01233000
24+
123456790.12344000
25+
1234567901.23455000

regtests/0355_wsdl_decimal/test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from test_support import *
2+
3+
exec_cmd('ada2wsdl',
4+
['-q', '-f', '-Pwsdl_d_main',
5+
'-a', 'http://localhost:7721', 'wsdl_d.ads', '-o', 'wsdl_d.wsdl'])
6+
exec_cmd('wsdl2aws',
7+
['-q', '-f', '-cb', '-types', 'wsdl_d', 'wsdl_d.wsdl'])
8+
9+
build_and_run('wsdl_d_main');
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
------------------------------------------------------------------------------
2+
-- Ada Web Server --
3+
-- --
4+
-- Copyright (C) 2024, AdaCore --
5+
-- --
6+
-- This is free software; you can redistribute it and/or modify it --
7+
-- under terms of the GNU General Public License as published by the --
8+
-- Free Software Foundation; either version 3, or (at your option) any --
9+
-- later version. This software is distributed in the hope that it will --
10+
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
11+
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
12+
-- General Public License for more details. --
13+
-- --
14+
-- You should have received a copy of the GNU General Public License --
15+
-- distributed with this software; see file COPYING3. If not, go --
16+
-- to http://www.gnu.org/licenses for a complete copy of the license. --
17+
------------------------------------------------------------------------------
18+
19+
with AWS.Utils;
20+
21+
with Ada.Text_IO;
22+
23+
package body WSDL_D is
24+
25+
use Ada;
26+
use AWS;
27+
28+
----------
29+
-- Call --
30+
----------
31+
32+
procedure Call (O : R) is
33+
begin
34+
Text_IO.Put_Line (O.D'Img);
35+
end Call;
36+
37+
-----------
38+
-- Print --
39+
-----------
40+
41+
procedure Print (D : SOAP.Types.Decimal) is
42+
begin
43+
Text_IO.Put_Line (D'Img);
44+
end Print;
45+
46+
-----------------
47+
-- Print_Price --
48+
-----------------
49+
50+
procedure Print_Price (P : Price) is
51+
begin
52+
Text_IO.Put_Line (P'Img);
53+
end Print_Price;
54+
55+
-----------
56+
-- Image --
57+
-----------
58+
59+
function Image (D : SOAP.Types.Decimal) return String is
60+
begin
61+
return D'Img;
62+
end Image;
63+
64+
end WSDL_D;

0 commit comments

Comments
 (0)