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

SOAP::Lite->service(WSDL) and cookie authentification

Expand Messages
  • Michael Ablassmeier
    hi guys, im currently working on accessing a service with SOAP::Lite. This service uses cookie based authentification, so i need to pass a cookie_jar using the
    Message 1 of 1 , Oct 2, 2007
    • 0 Attachment
      hi guys,

      im currently working on accessing a service with SOAP::Lite. This service uses
      cookie based authentification, so i need to pass a cookie_jar using the
      HTTP::Cookies class in order to be able to call more than the login function.

      The FAQ states something along the lines:

      my $soap->proxy('http://localhost/',
      cookie_jar => HTTP::Cookies->new(ignore_discard => 1));

      but im using the ->service method, as the webservice provides a WSDL File.
      As far as i can see i cant pass cooke_jar to ->service, so i did something
      like this:

      my $COOKIE_FILE = '/tmp/bs-wsdl-cookies.txt';
      my $cookie_jar = HTTP::Cookies->new(ignore_discard => 1,
      file => $COOKIE_FILE,
      autosave=>1);

      $login = $service->login($loginName, $password, $newPassword, $mode);
      $service->transport->cookie_jar($cookie_jar);


      this, does not work. It simply ignores the fact that there is a cookie on the
      first call. If i call the above statements *twice*, like:

      $login = $service->login($loginName, $password, $newPassword, $mode);
      $service->transport->cookie_jar($cookie_jar);
      $login = $service->login($loginName, $password, $newPassword, $mode);
      $service->transport->cookie_jar($cookie_jar);

      it works.

      Anyone knows how i can pass the cookie_jar to the Transport layer *before*
      communication starts, so i dont have to call the login method twice?

      bye,
      - michael
    Your message has been successfully submitted and would be delivered to recipients shortly.