Loading ...
Sorry, an error occurred while loading the content.

How to access request and response in server method

Expand Messages
  • Peter Ehrenberg
    I wonder how to global objects make accessible for methods called on server site. Any such global objects are for example: o a database connection object o
    Message 1 of 2 , May 7, 2002
    • 0 Attachment
      I wonder how to "global objects" make accessible for methods called on
      server site. Any such global objects are for example:

      o a database connection object

      o the request object

      o the respond object

      The database connection is created by the early stage of the (my) main
      program. It is permanent for any subsequent request and are used by
      nearly all called method.

      The request and response objects are created by the handle()-Method
      from the SOAP::Server class. I have to access them in my authorization
      class to check and set http cookies.

      My question now is: What is the most elegant way to implement a access
      path (or already exists one?), so that every by handle() called method
      can use these objects?

      Peter
      --
      Dipl.-Ing. Peter Ehrenberg Tel.: (040) 756604-40
      Rotenhäuser Straße 51 Fax: (040) 756604-41
      21109 Hamburg Netz: http://www.dipe.de
      Germany mailto:pe@...
    • Paul Kulchenko
      Hi, Peter! It should be pretty easy to do with a database connection object which is per server instance object as far as I understand. You can do something
      Message 2 of 2 , May 9, 2002
      • 0 Attachment
        Hi, Peter!

        It should be pretty easy to do with a database connection object
        which is per server instance object as far as I understand. You can
        do something like this:

        package My::Server;
        use SOAP::Transport::HTTP;

        my $server = SOAP::Transport::HTTP::Daemon->....;
        $My::Server::db_handle = ....;
        $server->handle;

        and you can access $My::Server::db_handle from your methods.

        To get access to request/response object, you may override
        request/response methods of SOAP::Server (or any inherited class,
        like SOAP::Transport::HTTP::Daemon). Although there is no easy way to
        pass this information down to your method. If you find the way, let
        me know; for now your best bet is probably global variables, even if
        won't work for non-sequential processing on server side. Let me know
        if you find a better solution, I'll document it. Thanks.

        Best wishes, Paul.

        --- Peter Ehrenberg <pe@...> wrote:
        > I wonder how to "global objects" make accessible for methods called
        > on server site. Any such global objects are for example:
        >
        > o a database connection object
        >
        > o the request object
        >
        > o the respond object
        >
        > The database connection is created by the early stage of the (my)
        > main
        > program. It is permanent for any subsequent request and are used by
        > nearly all called method.
        >
        > The request and response objects are created by the handle()-Method
        > from the SOAP::Server class. I have to access them in my
        > authorization
        > class to check and set http cookies.
        >
        > My question now is: What is the most elegant way to implement a
        > access
        > path (or already exists one?), so that every by handle() called
        > method
        > can use these objects?
        >
        > Peter
        > --
        > Dipl.-Ing. Peter Ehrenberg Tel.: (040)
        > 756604-40
        > Rotenh�user Stra�e 51 Fax: (040)
        > 756604-41
        > 21109 Hamburg Netz:
        > http://www.dipe.de
        > Germany
        > mailto:pe@...
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Yahoo! Shopping - Mother's Day is May 12th!
        http://shopping.yahoo.com
      Your message has been successfully submitted and would be delivered to recipients shortly.