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

Re: [soaplite] Getting info out of headers

Expand Messages
  • Paul Kulchenko
    Hi, Steve! ... I don t think it doesn t work, at least it works for me (it should, right? :)) ... this will return SOAP::Header object, and you probably
    Message 1 of 3 , Jul 11 1:48 PM
    • 0 Attachment
      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:encodingStyle="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 Demo;
      >
      > 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/
    Your message has been successfully submitted and would be delivered to recipients shortly.