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

Sending Cookies via Soap

Expand Messages
  • Dianne Van Dulken
    Hi, Can anyone tell me what I am doing wrong here? I am trying to send a cookie with my soap request, and I thought that this is the way to do it, but it
    Message 1 of 3 , Jul 11, 2004
    • 0 Attachment
      Hi,

      Can anyone tell me what I am doing wrong here? I am trying to send a
      cookie with my soap request, and I thought that this is the way to do
      it, but it isn't getting sent.

      My code is

      #!/usr/bin/perl -w
      use LWP::Protocol::https;
      use SOAP::Lite;
      my $fnn = '0296755004'; # phone number to be checked.
      my $productOffering = 'Layer-2';
      my $spReferenceNbr = '12341234';
      my $spContactName = 'Foo';
      my $spContactNumber = '0296755004';
      $soap = SOAP::Lite
      -> uri('http://bean.b2b.lolo2.telstra.com')
      -> encoding('Shift_JIS')
      -> on_debug(sub{print@_})
      -> on_action( sub { join '/', 'http://bean.b2b.lolo2.telstra.com', $_[1]
      } )
      ->
      proxy('https://shopfront3.telstra.com.au/LOLOSTGCb2b/services/ServiceQua
      lImmService'),
      cookie_jar => HTTP::Cookies->load(
      file => "lwp_cookies.dat",
      AutoSave => 1
      )
      ;

      $method = SOAP::Data->name('ServiceQualImmRequest')->attr({xmlns =>
      'http://bean.b2b.lolo2.telstra.com/'});
      @params = (
      SOAP::Data->name("sqdetailsreq"=>
      \SOAP::Data->value(SOAP::Data->name("spReferenceNbr" =>
      $spReferenceNbr),
      SOAP::Data->name("spContactName" => $spContactName),
      SOAP::Data->name("spContactPhoneNbr" => $spContactNumber))),
      SOAP::Data->name("sqitemdetailsreq"=>
      \SOAP::Data->value(SOAP::Data->name("fnn" => $fnn),
      SOAP::Data->name("productOffering" =>
      $productOffering))));
      $result = $soap->headers($method => @params);
      print "Search result: " . $result . "\n";

      Is there anything obviously wrong there?

      Thanks

      Dianne
    • Duncan Cameron
      At 2004-07-12, 02:02:18 Dianne Van Dulken
      Message 2 of 3 , Jul 12, 2004
      • 0 Attachment
        At 2004-07-12, 02:02:18 Dianne Van Dulken <Dianne.VanDulken@team.
        ozemail.com.au> wrote:

        >Hi,
        >
        >Can anyone tell me what I am doing wrong here? I am trying to send a
        >cookie with my soap request, and I thought that this is the way to do
        >it, but it isn't getting sent.
        >
        >My code is
        >
        >#!/usr/bin/perl -w
        >use LWP::Protocol::https;
        >use SOAP::Lite;
        > my $fnn = '0296755004'; # phone number to be checked.
        > my $productOffering = 'Layer-2';
        > my $spReferenceNbr = '12341234';
        > my $spContactName = 'Foo';
        > my $spContactNumber = '0296755004';
        >$soap = SOAP::Lite
        >-> uri('http://bean.b2b.lolo2.telstra.com')
        >-> encoding('Shift_JIS')
        >-> on_debug(sub{print@_})
        >-> on_action( sub { join '/', 'http://bean.b2b.lolo2.telstra.com',
        >$_[1]
        >} )
        >->
        >proxy('https://shopfront3.telstra.com.
        >au/LOLOSTGCb2b/services/ServiceQua
        >lImmService'),
        > cookie_jar => HTTP::Cookies->load(
        > file => "lwp_cookies.dat",
        > AutoSave => 1
        >)
        Don't know whether this is just a typo in your email but cookie_jar
        needs to be a parameter to proxy()

        proxy(
        'https://shopfront3.telstra.com.au/LOLOSTGCb2b/services/ServiceQualImmService',
        cookie_jar => HTTP::Cookies->load(
        file => "lwp_cookies.dat",
        AutoSave => 1
        )
        )

        Also you have not use'd HTTP::Cookies

        >$method = SOAP::Data->name('ServiceQualImmRequest')->attr({xmlns =>
        >'http://bean.b2b.lolo2.telstra.com/'});
        >@params = (
        > SOAP::Data->name("sqdetailsreq"=>
        > \SOAP::Data->value(SOAP::Data->name("spReferenceNbr" =>
        >$spReferenceNbr),
        > SOAP::Data->name("spContactName" => $spContactName),
        > SOAP::Data->name("spContactPhoneNbr" =>
        >$spContactNumber))),
        > SOAP::Data->name("sqitemdetailsreq"=>
        > \SOAP::Data->value(SOAP::Data->name("fnn" => $fnn),
        > SOAP::Data->name("productOffering" =>
        >$productOffering))));
        >$result = $soap->headers($method => @params);

        What is the headers() method meant to do?

        Regards
        Duncan
      • Alasdair Allan
        ... See http://www.estar.org.uk/pages/software.html for my Cookie Daemon code as an example of how to do this... Al.
        Message 3 of 3 , Jul 12, 2004
        • 0 Attachment
          > Can anyone tell me what I am doing wrong here? I am trying to send a
          > cookie with my soap request, and I thought that this is the way to do
          > it, but it isn't getting sent.

          See http://www.estar.org.uk/pages/software.html for my Cookie Daemon code
          as an example of how to do this...

          Al.
        Your message has been successfully submitted and would be delivered to recipients shortly.