
--  wsdl2aws SOAP Generator v2.3.0
--
--  AWS 3.1.0w - SOAP 1.5.0
--  This file was generated on Thursday 27 June 2013 at 17:35:46
--
--  $ wsdl2aws -cb -types Log4Ada ../wsdl/logging.wsdl

with Ada.Exceptions;

with SOAP.Message.Response.Error;
pragma Elaborate_All (SOAP);
pragma Elaborate_All (SOAP.Message);
pragma Elaborate_All (SOAP.Message.Response);
pragma Elaborate_All (SOAP.Message.Response.Error);
with SOAP.Parameters;
pragma Elaborate_All (SOAP.Parameters);
with SOAP.Utils;
pragma Elaborate_All (SOAP.Utils);

package body Logging_Service.Server is

   use Ada.Exceptions;

   use SOAP.Types;
   use type SOAP.Parameters.List;

   pragma Warnings (Off);
   --  Suppress wrong warnings generated by GNAT (fixed in 3.17)

   pragma Style_Checks (Off);

   ------------------------
   -- Create_File_Log_CB --
   ------------------------

   function Create_File_Log_CB
     (SOAPAction : String;
      Payload    : SOAP.Message.Payload.Object;
      Request    : AWS.Status.Data)
      return AWS.Response.Data
   is
      Proc_Name : constant String
        := SOAP.Message.Payload.Procedure_Name (Payload);
      Params    : constant SOAP.Parameters.List
        := SOAP.Message.Parameters (Payload);
      Response  : SOAP.Message.Response.Object;
      R_Params  : SOAP.Parameters.List;
   begin
      if SOAPAction /= "Create_File_Log" then
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "SOAPAction " & SOAPAction & " in Create_File_Log, "
                 & "Create_File_Log expected."));
      end if;

      if Proc_Name /= "Create_File_Log" then
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "Found procedure " & Proc_Name & " in Create_File_Log, "
                 & "Create_File_Log expected."));
      end if;

      Response := SOAP.Message.Response.From (Payload);

      declare
         Name_ID : constant String
           := SOAP.Parameters.Get (Params, "Name_ID");
      begin
         Create_File_Log                (Name_ID);
      end;

      SOAP.Message.Set_Parameters (Response, R_Params);
      return SOAP.Message.Response.Build (Response);
   exception
      when E : SOAP.Types.Data_Error =>
         --  Here we have a problem with some parameters, return a SOAP error
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "Parameter error in Create_File_Log ("
                 & Exception_Message (E) & ")"));
      when O : others =>
         --  Here we have a problem with user's callback, return a SOAP error
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "Error in Create_File_Log ("
                 & Exception_Message (O) & ")"));
   end Create_File_Log_CB;

   -----------------------
   -- Close_File_Log_CB --
   -----------------------

   function Close_File_Log_CB
     (SOAPAction : String;
      Payload    : SOAP.Message.Payload.Object;
      Request    : AWS.Status.Data)
      return AWS.Response.Data
   is
      Proc_Name : constant String
        := SOAP.Message.Payload.Procedure_Name (Payload);
      Params    : constant SOAP.Parameters.List
        := SOAP.Message.Parameters (Payload);
      Response  : SOAP.Message.Response.Object;
      R_Params  : SOAP.Parameters.List;
   begin
      if SOAPAction /= "Close_File_Log" then
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "SOAPAction " & SOAPAction & " in Close_File_Log, "
                 & "Close_File_Log expected."));
      end if;

      if Proc_Name /= "Close_File_Log" then
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "Found procedure " & Proc_Name & " in Close_File_Log, "
                 & "Close_File_Log expected."));
      end if;

      Response := SOAP.Message.Response.From (Payload);

      declare
         Name_ID : constant String
           := SOAP.Parameters.Get (Params, "Name_ID");
      begin
         Close_File_Log                (Name_ID);
      end;

      SOAP.Message.Set_Parameters (Response, R_Params);
      return SOAP.Message.Response.Build (Response);
   exception
      when E : SOAP.Types.Data_Error =>
         --  Here we have a problem with some parameters, return a SOAP error
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "Parameter error in Close_File_Log ("
                 & Exception_Message (E) & ")"));
      when O : others =>
         --  Here we have a problem with user's callback, return a SOAP error
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "Error in Close_File_Log ("
                 & Exception_Message (O) & ")"));
   end Close_File_Log_CB;

   -------------------
   -- Append_Log_CB --
   -------------------

   function Append_Log_CB
     (SOAPAction : String;
      Payload    : SOAP.Message.Payload.Object;
      Request    : AWS.Status.Data)
      return AWS.Response.Data
   is
      Proc_Name : constant String
        := SOAP.Message.Payload.Procedure_Name (Payload);
      Params    : constant SOAP.Parameters.List
        := SOAP.Message.Parameters (Payload);
      Response  : SOAP.Message.Response.Object;
      R_Params  : SOAP.Parameters.List;
   begin
      if SOAPAction /= "Append_Log" then
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "SOAPAction " & SOAPAction & " in Append_Log, "
                 & "Append_Log expected."));
      end if;

      if Proc_Name /= "Append_Log" then
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "Found procedure " & Proc_Name & " in Append_Log, "
                 & "Append_Log expected."));
      end if;

      Response := SOAP.Message.Response.From (Payload);

      declare
         Name_ID : constant String
           := SOAP.Parameters.Get (Params, "Name_ID");
         Message : constant String
           := SOAP.Parameters.Get (Params, "Message");
         Level   : constant Level_Type_Type
           := Level_Type_Type'Value
                (SOAP.Utils.Get (SOAP.Parameters.Argument (Params, "Level")));
      begin
         Append_Log                (Name_ID,
                 Message,
                 Level);
      end;

      SOAP.Message.Set_Parameters (Response, R_Params);
      return SOAP.Message.Response.Build (Response);
   exception
      when E : SOAP.Types.Data_Error =>
         --  Here we have a problem with some parameters, return a SOAP error
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "Parameter error in Append_Log ("
                 & Exception_Message (E) & ")"));
      when O : others =>
         --  Here we have a problem with user's callback, return a SOAP error
         return SOAP.Message.Response.Build
           (SOAP.Message.Response.Error.Build
              (SOAP.Message.Response.Error.Client,
               "Error in Append_Log ("
                 & Exception_Message (O) & ")"));
   end Append_Log_CB;

end Logging_Service.Server;
