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

FW: [soaplite] Getting info out of headers

Expand Messages
  • McKay, Steve
    Thanks Paul, that worked. I have a question then on soap correctness . I noticed a previous post where you gave advice on interoperability with other soap
    Message 1 of 1 , Jul 11, 2001
    • 0 Attachment
      Thanks Paul, that worked.

      I have a question then on soap "correctness".  I noticed a previous post where you gave advice on interoperability with other soap implementations (I believe it was dealing with the namespace). Is it more "correct" to do:

      Client:
      my $authInfo = SOAP::Header->name(key => $key);

      Server:
      my $som = pop->valueof(SOAP::SOM::header);
      print $som->{'key'};

      OR 

      Client
      my $authInfo = SOAP::Header
          ->name("authInfo")
          ->type('ordered_hash'=> [key => $key])
          ->uri('Demo');

      Server:
      $som = pop->valueof('//authInfo');
      print $som->{'key'};



      Thanks in advance.



      Paul Kulchenko wrote:
      Hi, Steve!

      this list, but still can't get it to work. Im using the following
      I don't think it doesn't work, at least it works for me (it should,
      right? :))

          my $header = pop->headerof(SOAP::SOM::header);
      this will return SOAP::Header object, and you probably looking to see
      your hash, then you need to do:

      my $header = pop->valueof(SOAP::SOM::header);

      which will return hash with header names as keys and values as
      values.

      Let me know if it doesn't work for you.

      Best wishes, Paul.

      --- Steve McKay <smckay@...> wrote:
      Im trying to pass info in a soap header.  I've read the recent
      emails on
      this list, but still can't get it to work. Im using the following
      client
      code:

      use SOAP::Lite

      my $key="123456";
      my $name="bob";

      # convert key into the Header
      my $authInfo = SOAP::Header->name(key => $key);

      my $soap = SOAP::Lite
      -> uri('Demo')
      -> proxy("$http://localhost:$server_port")
      -> hi($name,$authInfo);

      print $soap->fault ? $soap->faultstring."\n" : $soap->result;


      The data looks like it is getting transferred correctly(the key is
      in
      the header). Here is the xml transferred to the soap server:

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      SOAP-ENV:encod ingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      <SOAP-ENV:Header><key
      xsi:type="xsd:int">123456</key></SOAP-ENV:Header>
      <SOAP-ENV:Body><namesp1:hi xmlns:namesp1="Demo">
      <c-gensym5
      xsi:type="xsd:string">bob</c-gensym5></namesp1:hi></SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      How do I pull this info out on the server side? Im using
      autodispatch,
      the Demo module is:

      package D emo;

      use vars qw(@ISA);
      @ISA = qw(SOAP::Server::Parameters);

      use SOAP::Lite;

      sub hi {
      my ($self, $name) = @_;

      #This doesn't seem to work
      my $header = pop->headerof(SOAP::SOM::header);
      print "header:\n";
      print Dumper $header;

      #Neither does this
      my $key = SOAP::Lite->self->call->valueof('//key');
      print "key:";
      print $key."\n";

      return "hello, $name\n";

      }

      1;



      Any help would be appreciated.


      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!?
      Get personalized email addresses from Yahoo! Mail
      http://personal.mail.yahoo.com/

      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/


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