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

Re: [soaplite] Setting Cookies/SOAP Headers???

Expand Messages
  • Paul Kulchenko
    Hi, Brian! ... I don t have ready-to-use example in my hands, but something like this should work: use HTTP::Cookies; my $cookies =
    Message 1 of 2 , Feb 9, 2001
    • 0 Attachment
      Hi, Brian!

      --- Brian Skrab <bgs@...> wrote:
      > Can anyone give me an example of how I can go about
      > getting/setting
      > HTTP cookies from a SOAP::Lite call to a service?
      I don't have ready-to-use example in my hands, but something like
      this should work:

      use HTTP::Cookies;

      my $cookies = HTTP::Cookies->new(ignore_discard => 1);
      # you may also add 'file' if you want to keep them between sessions

      my $soap = SOAP::Lite

      Cookie will be taken from response and provided for request. You may
      always add another cookie (or extract what you need after response)
      with HTTP::Cookies interface.

      You may also do it in one line:

      my $soap = SOAP::Lite
      cookie_jar => HTTP::Cookies->new(ignore_discard => 1));

      Actually proxy will accept ANY parameters that LWP::UserAgent has.
      See PROXY SETTINGS (in HTTP.pm) for example of this interface. You
      may get access to it thru $soap->transport object which represents
      Transport side (depending on real transport). Same thing is true for
      other protocols. Protocol/module specific parameters could be passed
      as additional parameters for proxy or accessed with $soap->transport.
      Thus you have access to almost all features of underlying modules.
      Hopefully :).

      > Creating/getting
      > SOAP headers from an envelope would be useful. Any example

      You may set headers with SOAP::Trace interface:

      use SOAP::Lite +trace =>
      transport => \&sub_that_will_get_both_request_and_response;

      If you want to update only request or response you may check with ref
      or UNIVERSAL::isa($_[0] => 'HTTP::Request'). See SOAP::Trace section
      in doc for information. Request will be passed BEFORE and response
      AFTER processing, and since objects are passed by ref, all changes
      will be effective.

      However this interface has some disadvantages (it's global, so it'll
      be effective for all you objects), so quite possible it'll be
      replaced by OO interface. Still under design. Hope it helps.

      Best wishes, Paul.

      Do You Yahoo!?
      Get personalized email addresses from Yahoo! Mail - only $35
      a year! http://personal.mail.yahoo.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.