mirror of
https://github.com/AdaCore/aws.git
synced 2026-02-12 12:29:46 -08:00
Fix schema handling in WSDL.
First the tool ada2wsdl does not generate targetNamespace in elements inside the schema as this is not valid. When there is multiple schema used, ada2wsdl generates multiple schema one for each targetNamespace. At the same time the wsdl2aws has been fixed to support multiple schema definition. This change was needed to properly support derived types for which the base type are found in different packages. So have different targetNamespace. Some tests expected output have been changed due to the change above, the new output are better as the original namespace is kept. Add corresponding regression tests. For Q309-017 and Q301-031.
This commit is contained in:
@@ -2,37 +2,37 @@
|
||||
125
|
||||
==============================
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
<xsd:simpleType name="T1"
|
||||
<xsd:simpleType name="T1">
|
||||
<xsd:restriction base="xsd:int">
|
||||
<xsd:minInclusive value=" 1"/>
|
||||
<xsd:maxInclusive value=" 9345"/>
|
||||
<xsd:simpleType name="T2"
|
||||
<xsd:simpleType name="T2">
|
||||
<xsd:restriction base="xsd:byte">
|
||||
<xsd:minInclusive value=" 1"/>
|
||||
<xsd:maxInclusive value=" 127"/>
|
||||
<xsd:simpleType name="T3"
|
||||
<xsd:simpleType name="T3">
|
||||
<xsd:restriction base="xsd:byte">
|
||||
<xsd:simpleType name="T4"
|
||||
<xsd:simpleType name="T4">
|
||||
<xsd:restriction base="xsd:short">
|
||||
<xsd:minInclusive value=" 0"/>
|
||||
<xsd:maxInclusive value=" 896"/>
|
||||
<xsd:simpleType name="T5"
|
||||
<xsd:simpleType name="T5">
|
||||
<xsd:restriction base="xsd:int">
|
||||
<xsd:minInclusive value=" 1"/>
|
||||
<xsd:simpleType name="T6"
|
||||
<xsd:simpleType name="T6">
|
||||
<xsd:restriction base="xsd:float">
|
||||
<xsd:minInclusive value=" 0.00000000000000E+00"/>
|
||||
<xsd:maxInclusive value=" 1.00000000000000E+00"/>
|
||||
<xsd:simpleType name="T7"
|
||||
<xsd:simpleType name="T7">
|
||||
<xsd:restriction base="xsd:double">
|
||||
<xsd:minInclusive value="-1.00000000000000E+00"/>
|
||||
<xsd:simpleType name="T8"
|
||||
<xsd:simpleType name="T8">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:Length value="10"/>
|
||||
<xsd:simpleType name="T9"
|
||||
<xsd:simpleType name="T9">
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:simpleType name="TA"
|
||||
<xsd:simpleType name="TA">
|
||||
<xsd:restriction base="xsd:unsignedByte">
|
||||
<xsd:maxInclusive value=" 13"/>
|
||||
<xsd:simpleType name="TB"
|
||||
<xsd:simpleType name="TB">
|
||||
<xsd:restriction base="xsd:unsignedShort">
|
||||
|
||||
@@ -14,13 +14,13 @@ maximumQueueSize = 16
|
||||
<soapenv:Body
|
||||
xmlns:awsns="http://soapaws/"
|
||||
xmlns:abc="http://aurn.here.org/abc"
|
||||
xmlns:n1="http://aurn.here.org/spatial">
|
||||
xmlns:sp="http://aurn.here.org/spatial">
|
||||
<abc:executeRequest>
|
||||
<abc:executionTime>XXXX-XX-XXTXX:XX:XXZ</abc:executionTime>
|
||||
<abc:valueA>
|
||||
<abc:latLong>
|
||||
<n1:latitudeDegrees>1.00000000000000</n1:latitudeDegrees>
|
||||
<n1:longitudeDegrees>1.10000000000000</n1:longitudeDegrees>
|
||||
<sp:latitudeDegrees>1.00000000000000</sp:latitudeDegrees>
|
||||
<sp:longitudeDegrees>1.10000000000000</sp:longitudeDegrees>
|
||||
</abc:latLong>
|
||||
<abc:field7>3.00000000000000</abc:field7>
|
||||
<abc:field8>4.00000000000000</abc:field8>
|
||||
@@ -31,8 +31,8 @@ maximumQueueSize = 16
|
||||
</abc:valueA>
|
||||
<abc:valueA>
|
||||
<abc:latLong>
|
||||
<n1:latitudeDegrees>2.00000000000000</n1:latitudeDegrees>
|
||||
<n1:longitudeDegrees>2.10000000000000</n1:longitudeDegrees>
|
||||
<sp:latitudeDegrees>2.00000000000000</sp:latitudeDegrees>
|
||||
<sp:longitudeDegrees>2.10000000000000</sp:longitudeDegrees>
|
||||
</abc:latLong>
|
||||
<abc:field7>3.20000000000000</abc:field7>
|
||||
<abc:field8>4.20000000000000</abc:field8>
|
||||
|
||||
23
regtests/0292_multiple_schema/another.ads
Normal file
23
regtests/0292_multiple_schema/another.ads
Normal file
@@ -0,0 +1,23 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
package Another is
|
||||
|
||||
type Data is new Integer;
|
||||
|
||||
end Another;
|
||||
33
regtests/0292_multiple_schema/api-child.adb
Normal file
33
regtests/0292_multiple_schema/api-child.adb
Normal file
@@ -0,0 +1,33 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with Ada.Text_IO;
|
||||
|
||||
package body API.Child is
|
||||
|
||||
procedure Call (O : Rec) is
|
||||
begin
|
||||
Ada.Text_IO.Put_Line ("API.Call : " & To_String (O.V));
|
||||
Ada.Text_IO.Put_Line (" : " & O.C'Img);
|
||||
Ada.Text_IO.Put_Line (" : " & O.D'Img);
|
||||
exception
|
||||
when others =>
|
||||
Ada.Text_IO.Put_Line ("API.Call!!!!!");
|
||||
end Call;
|
||||
|
||||
end API.Child;
|
||||
40
regtests/0292_multiple_schema/api-child.ads
Normal file
40
regtests/0292_multiple_schema/api-child.ads
Normal file
@@ -0,0 +1,40 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with Ada.Strings.Unbounded;
|
||||
|
||||
with Another;
|
||||
|
||||
package API.Child is
|
||||
|
||||
use Ada.Strings.Unbounded;
|
||||
|
||||
subtype T is API.T;
|
||||
type Data is new Another.Data;
|
||||
|
||||
type Rec is record
|
||||
V : Unbounded_String;
|
||||
A : Integer;
|
||||
B : Unbounded_String;
|
||||
C : T;
|
||||
D : Data;
|
||||
end record;
|
||||
|
||||
procedure Call (O : Rec);
|
||||
|
||||
end API.Child;
|
||||
23
regtests/0292_multiple_schema/api.ads
Normal file
23
regtests/0292_multiple_schema/api.ads
Normal file
@@ -0,0 +1,23 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
package API is
|
||||
|
||||
type T is new Integer;
|
||||
|
||||
end API;
|
||||
102
regtests/0292_multiple_schema/multiple_schema.adb
Normal file
102
regtests/0292_multiple_schema/multiple_schema.adb
Normal file
@@ -0,0 +1,102 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- SOAP/WSDL test
|
||||
|
||||
with Ada.Strings.Unbounded;
|
||||
with Ada.Text_IO;
|
||||
|
||||
with AWS.Config.Set;
|
||||
with AWS.MIME;
|
||||
with AWS.Net;
|
||||
with AWS.Response;
|
||||
with AWS.Server.Status;
|
||||
with AWS.Status;
|
||||
|
||||
with SOAP.Dispatchers.Callback;
|
||||
with SOAP.Utils;
|
||||
|
||||
with API.Child_Service.CB;
|
||||
with API.Child_Service.Client;
|
||||
with API.Child_Service.Server;
|
||||
|
||||
with API.Child;
|
||||
|
||||
procedure Multiple_Schema is
|
||||
|
||||
use Ada.Strings.Unbounded;
|
||||
use AWS;
|
||||
|
||||
H_Server : Server.HTTP;
|
||||
CNF : Config.Object;
|
||||
Disp : API.Child_Service.CB.Handler;
|
||||
|
||||
procedure WSDL_Demo_Client is
|
||||
use Ada;
|
||||
R : API.Child.Rec;
|
||||
begin
|
||||
R.V := To_Unbounded_String ("from client");
|
||||
R.C := 5;
|
||||
R.D := 9912;
|
||||
API.Child_Service.Client.Call
|
||||
(O => R,
|
||||
Endpoint => AWS.Server.Status.Local_URL (H_Server));
|
||||
end WSDL_Demo_Client;
|
||||
|
||||
--------
|
||||
-- CB --
|
||||
--------
|
||||
|
||||
function CB (Request : Status.Data) return Response.Data is
|
||||
SOAPAction : constant String := Status.SOAPAction (Request);
|
||||
begin
|
||||
return Response.Build (MIME.Text_HTML, "<p>Not a SOAP request");
|
||||
end CB;
|
||||
|
||||
begin
|
||||
Config.Set.Server_Name (CNF, "WSDL Multiple Schema");
|
||||
Config.Set.Server_Host (CNF, "localhost");
|
||||
Config.Set.Server_Port (CNF, 0);
|
||||
|
||||
Disp := SOAP.Dispatchers.Callback.Create
|
||||
(CB'Unrestricted_Access,
|
||||
API.Child_Service.CB.SOAP_CB'Access,
|
||||
API.Child_Service.Schema);
|
||||
|
||||
Server.Start (H_Server, Disp, CNF);
|
||||
|
||||
if Net.IPv6_Available then
|
||||
-- Need to start second server on same port but on the different
|
||||
-- Protocol_Family because we do not know which family would client try
|
||||
-- to connect.
|
||||
|
||||
if AWS.Server.Status.Is_IPv6 (H_Server) then
|
||||
Server.Add_Listening
|
||||
(H_Server, "localhost",
|
||||
AWS.Server.Status.Port (H_Server), Net.FAMILY_INET);
|
||||
else
|
||||
Server.Add_Listening
|
||||
(H_Server, "localhost",
|
||||
AWS.Server.Status.Port (H_Server), Net.FAMILY_INET6);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
WSDL_Demo_Client;
|
||||
|
||||
Server.Shutdown (H_Server);
|
||||
end Multiple_Schema;
|
||||
24
regtests/0292_multiple_schema/multiple_schema.gpr
Normal file
24
regtests/0292_multiple_schema/multiple_schema.gpr
Normal file
@@ -0,0 +1,24 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with "aws";
|
||||
|
||||
project Multiple_Schema is
|
||||
for Source_Dirs use (".");
|
||||
for Main use ("multiple_schema.adb");
|
||||
end Multiple_Schema;
|
||||
2
regtests/0292_multiple_schema/test.opt
Normal file
2
regtests/0292_multiple_schema/test.opt
Normal file
@@ -0,0 +1,2 @@
|
||||
!xmlada DEAD
|
||||
!asis DEAD
|
||||
3
regtests/0292_multiple_schema/test.out
Normal file
3
regtests/0292_multiple_schema/test.out
Normal file
@@ -0,0 +1,3 @@
|
||||
API.Call : from client
|
||||
: 5
|
||||
: 9912
|
||||
8
regtests/0292_multiple_schema/test.py
Normal file
8
regtests/0292_multiple_schema/test.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from test_support import *
|
||||
|
||||
exec_cmd('ada2wsdl',
|
||||
['-q', '-lit', '-f', '-o', 'api-child.wsdl', 'api-child.ads'])
|
||||
|
||||
exec_cmd('wsdl2aws',
|
||||
['-q', '-f', '-spec', 'api.child', '-cb', 'api-child.wsdl'])
|
||||
build_and_run('multiple_schema')
|
||||
23
regtests/0293_multiple_schema/another.ads
Normal file
23
regtests/0293_multiple_schema/another.ads
Normal file
@@ -0,0 +1,23 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
package Another is
|
||||
|
||||
type Data is new Integer;
|
||||
|
||||
end Another;
|
||||
40
regtests/0293_multiple_schema/api-child.ads
Normal file
40
regtests/0293_multiple_schema/api-child.ads
Normal file
@@ -0,0 +1,40 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with Ada.Strings.Unbounded;
|
||||
|
||||
with Another;
|
||||
|
||||
package API.Child is
|
||||
|
||||
use Ada.Strings.Unbounded;
|
||||
|
||||
subtype T is API.T;
|
||||
type Data is new Another.Data;
|
||||
|
||||
type Rec is record
|
||||
V : Unbounded_String;
|
||||
A : Integer;
|
||||
B : Unbounded_String;
|
||||
C : T;
|
||||
D : Data;
|
||||
end record;
|
||||
|
||||
procedure Call (O : Rec);
|
||||
|
||||
end API.Child;
|
||||
83
regtests/0293_multiple_schema/api-child_service-cb.adb
Normal file
83
regtests/0293_multiple_schema/api-child_service-cb.adb
Normal file
@@ -0,0 +1,83 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with Ada.Exceptions;
|
||||
|
||||
with SOAP.Message.Response.Error;
|
||||
|
||||
with API_Imp;
|
||||
|
||||
with API.Child_Service.Server;
|
||||
with API.Child_Service.Types;
|
||||
|
||||
package body API.Child_Service.CB is
|
||||
|
||||
use Ada.Exceptions;
|
||||
use SOAP;
|
||||
|
||||
pragma Warnings (Off, API.Child_Service.Server);
|
||||
pragma Warnings (Off, API.Child_Service.Types);
|
||||
|
||||
pragma Style_Checks (Off);
|
||||
|
||||
function Call_CB is
|
||||
new API.Child_Service.Server.Call_CB (API_Imp.Call);
|
||||
|
||||
---------------------------
|
||||
-- Is_SOAPAction_Defined --
|
||||
---------------------------
|
||||
|
||||
function Is_SOAPAction_Defined
|
||||
(SOAPAction : String) return Boolean is
|
||||
begin
|
||||
if SOAPAction = "Call" then
|
||||
return True;
|
||||
else
|
||||
return False;
|
||||
end if;
|
||||
end Is_SOAPAction_Defined;
|
||||
|
||||
-------------
|
||||
-- SOAP_CB --
|
||||
-------------
|
||||
|
||||
function SOAP_CB
|
||||
(SOAPAction : String;
|
||||
Payload : Message.Payload.Object;
|
||||
Request : AWS.Status.Data)
|
||||
return Response.Data is
|
||||
begin
|
||||
if SOAPAction = "Call" then
|
||||
return Call_CB (SOAPAction, Payload, Request);
|
||||
|
||||
else
|
||||
return Message.Response.Build
|
||||
(Message.Response.Error.Build
|
||||
(Message.Response.Error.Client,
|
||||
"Wrong SOAP action " & SOAPAction));
|
||||
end if;
|
||||
exception
|
||||
when E : others =>
|
||||
return Message.Response.Build
|
||||
(Message.Response.Error.Build
|
||||
(Message.Response.Error.Client,
|
||||
"Error in SOAP_CB for SOAPAction " & SOAPAction
|
||||
& " (" & Exception_Information (E) & ")"));
|
||||
end SOAP_CB;
|
||||
|
||||
end API.Child_Service.CB;
|
||||
44
regtests/0293_multiple_schema/api-child_service-cb.ads
Normal file
44
regtests/0293_multiple_schema/api-child_service-cb.ads
Normal file
@@ -0,0 +1,44 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with AWS.Response;
|
||||
with AWS.Status;
|
||||
|
||||
with SOAP.Dispatchers.Callback;
|
||||
with SOAP.Message.Payload;
|
||||
|
||||
package API.Child_Service.CB is
|
||||
|
||||
use AWS;
|
||||
use SOAP;
|
||||
|
||||
pragma Style_Checks (Off);
|
||||
|
||||
subtype Handler is SOAP.Dispatchers.Callback.Handler;
|
||||
|
||||
function Is_SOAPAction_Defined
|
||||
(SOAPAction : String) return Boolean;
|
||||
-- Returns True if SOAPAction handled by SOAP_CB below
|
||||
|
||||
function SOAP_CB
|
||||
(SOAPAction : String;
|
||||
Payload : Message.Payload.Object;
|
||||
Request : AWS.Status.Data)
|
||||
return Response.Data;
|
||||
|
||||
end API.Child_Service.CB;
|
||||
23
regtests/0293_multiple_schema/api.ads
Normal file
23
regtests/0293_multiple_schema/api.ads
Normal file
@@ -0,0 +1,23 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
package API is
|
||||
|
||||
type T is new Integer;
|
||||
|
||||
end API;
|
||||
36
regtests/0293_multiple_schema/api_imp.adb
Normal file
36
regtests/0293_multiple_schema/api_imp.adb
Normal file
@@ -0,0 +1,36 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with Ada.Strings.Unbounded;
|
||||
with Ada.Text_IO;
|
||||
|
||||
package body API_Imp is
|
||||
|
||||
use Ada.Strings.Unbounded;
|
||||
|
||||
procedure Call (O : API.Child_Service.Types.Rec_Type) is
|
||||
begin
|
||||
Ada.Text_IO.Put_Line ("API.Call : " & To_String (O.V));
|
||||
Ada.Text_IO.Put_Line (" : " & O.C'Img);
|
||||
Ada.Text_IO.Put_Line (" : " & O.D'Img);
|
||||
exception
|
||||
when others =>
|
||||
Ada.Text_IO.Put_Line ("API.Call!!!!!");
|
||||
end Call;
|
||||
|
||||
end API_Imp;
|
||||
25
regtests/0293_multiple_schema/api_imp.ads
Normal file
25
regtests/0293_multiple_schema/api_imp.ads
Normal file
@@ -0,0 +1,25 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with API.Child_Service.Types;
|
||||
|
||||
package API_Imp is
|
||||
|
||||
procedure Call (O : API.Child_Service.Types.Rec_Type);
|
||||
|
||||
end API_Imp;
|
||||
101
regtests/0293_multiple_schema/multiple_schema.adb
Normal file
101
regtests/0293_multiple_schema/multiple_schema.adb
Normal file
@@ -0,0 +1,101 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- SOAP/WSDL test
|
||||
|
||||
with Ada.Strings.Unbounded;
|
||||
with Ada.Text_IO;
|
||||
|
||||
with AWS.Config.Set;
|
||||
with AWS.MIME;
|
||||
with AWS.Net;
|
||||
with AWS.Response;
|
||||
with AWS.Server.Status;
|
||||
with AWS.Status;
|
||||
|
||||
with SOAP.Dispatchers.Callback;
|
||||
with SOAP.Utils;
|
||||
|
||||
with API.Child_Service.CB;
|
||||
with API.Child_Service.Client;
|
||||
with API.Child_Service.Server;
|
||||
with API.Child_Service.Types;
|
||||
|
||||
procedure Multiple_Schema is
|
||||
|
||||
use Ada.Strings.Unbounded;
|
||||
use AWS;
|
||||
|
||||
H_Server : Server.HTTP;
|
||||
CNF : Config.Object;
|
||||
Disp : API.Child_Service.CB.Handler;
|
||||
|
||||
procedure WSDL_Demo_Client is
|
||||
use Ada;
|
||||
R : API.Child_Service.Types.Rec_Type;
|
||||
begin
|
||||
R.V := To_Unbounded_String ("from client");
|
||||
R.C := 5;
|
||||
R.D := 9912;
|
||||
API.Child_Service.Client.Call
|
||||
(O => R,
|
||||
Endpoint => AWS.Server.Status.Local_URL (H_Server));
|
||||
end WSDL_Demo_Client;
|
||||
|
||||
--------
|
||||
-- CB --
|
||||
--------
|
||||
|
||||
function CB (Request : Status.Data) return Response.Data is
|
||||
SOAPAction : constant String := Status.SOAPAction (Request);
|
||||
begin
|
||||
return Response.Build (MIME.Text_HTML, "<p>Not a SOAP request");
|
||||
end CB;
|
||||
|
||||
begin
|
||||
Config.Set.Server_Name (CNF, "WSDL Multiple Schema");
|
||||
Config.Set.Server_Host (CNF, "localhost");
|
||||
Config.Set.Server_Port (CNF, 0);
|
||||
|
||||
Disp := SOAP.Dispatchers.Callback.Create
|
||||
(CB'Unrestricted_Access,
|
||||
API.Child_Service.CB.SOAP_CB'Access,
|
||||
API.Child_Service.Schema);
|
||||
|
||||
Server.Start (H_Server, Disp, CNF);
|
||||
|
||||
if Net.IPv6_Available then
|
||||
-- Need to start second server on same port but on the different
|
||||
-- Protocol_Family because we do not know which family would client try
|
||||
-- to connect.
|
||||
|
||||
if AWS.Server.Status.Is_IPv6 (H_Server) then
|
||||
Server.Add_Listening
|
||||
(H_Server, "localhost",
|
||||
AWS.Server.Status.Port (H_Server), Net.FAMILY_INET);
|
||||
else
|
||||
Server.Add_Listening
|
||||
(H_Server, "localhost",
|
||||
AWS.Server.Status.Port (H_Server), Net.FAMILY_INET6);
|
||||
end if;
|
||||
end if;
|
||||
|
||||
WSDL_Demo_Client;
|
||||
|
||||
Server.Shutdown (H_Server);
|
||||
end Multiple_Schema;
|
||||
24
regtests/0293_multiple_schema/multiple_schema.gpr
Normal file
24
regtests/0293_multiple_schema/multiple_schema.gpr
Normal file
@@ -0,0 +1,24 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- Ada Web Server --
|
||||
-- --
|
||||
-- Copyright (C) 2017, AdaCore --
|
||||
-- --
|
||||
-- This is free software; you can redistribute it and/or modify it --
|
||||
-- under terms of the GNU General Public License as published by the --
|
||||
-- Free Software Foundation; either version 3, or (at your option) any --
|
||||
-- later version. This software is distributed in the hope that it will --
|
||||
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty --
|
||||
-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
|
||||
-- General Public License for more details. --
|
||||
-- --
|
||||
-- You should have received a copy of the GNU General Public License --
|
||||
-- distributed with this software; see file COPYING3. If not, go --
|
||||
-- to http://www.gnu.org/licenses for a complete copy of the license. --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
with "aws";
|
||||
|
||||
project Multiple_Schema is
|
||||
for Source_Dirs use (".");
|
||||
for Main use ("multiple_schema.adb");
|
||||
end Multiple_Schema;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user