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

Adding SOAP headers in a client

Expand Messages
  • Todd Ekenstam
    How do you add a SOAP header in the client? In the server I do something like: sub fake_login { $authInfo = +{ username = john_doe , timestamp =
    Message 1 of 3 , Nov 8, 2002
    • 0 Attachment
      How do you add a SOAP header in the client? In the server I do
      something like:

      sub fake_login {
      $authInfo = +{ 'username' => 'john_doe',
      'timestamp' => 1036799949,
      'signature' => '2c4db5d1650b8c98'};
      return 1, SOAP::Header->name(authInfo => $authInfo);
      }

      That works. But I don't see examples of how to do this on the client
      side.

      I'm trying to implement the ticket-based security as described in the
      Quick Start Guide, but the example doesn't seem to work for me.
      Perhaps it's relevant to an older SOAP::Lite version? I don't want
      to pass the authInfo as a parameter in the method; I want to add it
      to the header. Has anyone gotten this to work, with the authInfo
      being passed in the header?

      http://www.perl.com/pub/a/2001/04/24/soap.html#security%20(ssl,%
      20basic/digest%20authentication,%20cookiebased%20authentication,%
      20ticketbased%20authentication,%20access%20control)


      Thanks,

      Todd
    • Todd Ekenstam
      ... client ... Sorry, the Quick Start DOES work for the client side. # convert it into the Header $authInfo = SOAP::Header- name(authInfo = $authInfo); #
      Message 2 of 3 , Nov 11, 2002
      • 0 Attachment
        --- In soaplite@y..., "Todd Ekenstam" <tekenstam@y...> wrote:
        > How do you add a SOAP header in the client? In the server I do
        > something like:
        >
        > sub fake_login {
        > $authInfo = +{ 'username' => 'john_doe',
        > 'timestamp' => 1036799949,
        > 'signature' => '2c4db5d1650b8c98'};
        > return 1, SOAP::Header->name(authInfo => $authInfo);
        > }
        >
        > That works. But I don't see examples of how to do this on the
        client
        > side.

        Sorry, the Quick Start DOES work for the client side.

        # convert it into the Header
        $authInfo = SOAP::Header->name(authInfo => $authInfo);
        # invoke protected method
        $response = SOAP::Lite
        -> uri('http://www.soaplite.com/TicketAuth')
        -> proxy('http://myserver/cgi-bin/ticketauth.cgi')
        -> protected($authInfo, 'garbage');

        An argument of SOAP::Header->name provided as a parameter to the
        method is converted to a header much the same as a SOAP::Header->name
        is converted when provided as a return parameter.

        But now I can't seem to get the header back out on the server side.
        the Quick Start example says to do something like this:

        my $email = $checkAuthInfo->(pop->valueof('//authInfo'));

        However, I get a fault "Can't locate object method "valueof" via
        package "garbage" (perhaps you forgot to load "garbage"?"

        The pop is getting the last parameter, not the header.


        Any help would be appreciated.


        Thanks,

        Todd
      • Duncan Cameron
        ... .. ... Do you have a line like this? @TicketAuth::ISA = qw(SOAP::Server::Parameters); Regards, Duncan Cameron
        Message 3 of 3 , Nov 11, 2002
        • 0 Attachment
          On 2002-11-12 Todd Ekenstam wrote:
          >--- In soaplite@y..., "Todd Ekenstam" <tekenstam@y...> wrote:

          ..

          >But now I can't seem to get the header back out on the server side.
          >the Quick Start example says to do something like this:
          >
          > my $email = $checkAuthInfo->(pop->valueof('//authInfo'));
          >
          >However, I get a fault "Can't locate object method "valueof" via
          >package "garbage" (perhaps you forgot to load "garbage"?"
          >
          >The pop is getting the last parameter, not the header.
          Do you have a line like this?

          @TicketAuth::ISA = qw(SOAP::Server::Parameters);

          Regards,
          Duncan Cameron
        Your message has been successfully submitted and would be delivered to recipients shortly.