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

Nested header elements problem

Expand Messages
  • Stephen Strudwick
    Hi, I ve run into a problem I cant solve, i m trying to insert something like this:
    Message 1 of 3 , May 12, 2005
    • 0 Attachment
      Hi,

      I've run into a problem I cant solve, i'm trying to insert something like this:

      <AuthenticationInfo><userName>User</userName><password>Password</password></AuthenticationInfo>

      into the clients header response for authentication.

      I can insert it without nesting like this:

      print $service->OpGetListADSL(
      SOAP:: Header->name('username' => 'user'),
      SOAP:: Header->name('password' => 'pass')
      );

      And that kind of works, producing:

      <SOAP-ENV:Header>
      <password xsi:type="xsd:string">steve</password>
      </SOAP-ENV:Header>

      but puts the username in the body.. ?

      Then when I try and nest it in the same way as the SOAP::Data example:

      print $service->OpGetListADSL(

      SOAP::Header
      -> name(AuthenticationInfo =>
      \SOAP::Header->value(
      SOAP:: Header->name('username' => 'steve'),
      SOAP:: Header->name('password' => 'steve')))

      );

      it sticks it all in the body not the header:

      <SOAP-ENV:Body>
      <OpGetListADSL xmlns="">
      <AuthenticationInfo>
      <username xsi:type="xsd:string">steve</username>
      <password xsi:type="xsd:string">steve</password>
      </AuthenticationInfo>
      </OpGetListADSL>
      </SOAP-ENV:Body>

      I suspect I am misunderstanding how to do this, any pointers in the right
      direction would be appreciated as I am getting very confused.

      -
      stephen strudwick
    • Byrne Reese
      What version of SOAP::Lite are you using? At first glance this looks like a problem with SOAP::Lite - odd that noone has reported it yet.
      Message 2 of 3 , May 12, 2005
      • 0 Attachment
        What version of SOAP::Lite are you using? At first glance this looks
        like a problem with SOAP::Lite - odd that noone has reported it yet.

        Stephen Strudwick wrote:

        > Hi,
        >
        > I've run into a problem I cant solve, i'm trying to insert something
        > like this:
        >
        >
        > <AuthenticationInfo><userName>User</userName><password>Password</password></AuthenticationInfo>
        >
        > into the clients header response for authentication.
        >
        > I can insert it without nesting like this:
        >
        > print $service->OpGetListADSL(
        > SOAP:: Header->name('username' => 'user'),
        > SOAP:: Header->name('password' => 'pass')
        > );
        >
        > And that kind of works, producing:
        >
        > <SOAP-ENV:Header>
        > <password xsi:type="xsd:string">steve</password>
        > </SOAP-ENV:Header>
        >
        > but puts the username in the body.. ?
        >
        > Then when I try and nest it in the same way as the SOAP::Data example:
        >
        > print $service->OpGetListADSL(
        >
        > SOAP::Header
        > -> name(AuthenticationInfo =>
        > \SOAP::Header->value(
        > SOAP:: Header->name('username' => 'steve'),
        > SOAP:: Header->name('password' => 'steve')))
        >
        > );
        >
        > it sticks it all in the body not the header:
        >
        > <SOAP-ENV:Body>
        > <OpGetListADSL xmlns="">
        > <AuthenticationInfo>
        > <username xsi:type="xsd:string">steve</username>
        > <password xsi:type="xsd:string">steve</password>
        > </AuthenticationInfo>
        > </OpGetListADSL>
        > </SOAP-ENV:Body>
        >
        > I suspect I am misunderstanding how to do this, any pointers in the right
        > direction would be appreciated as I am getting very confused.
        >
        > -
        > stephen strudwick
        >
        >
        > ------------------------------------------------------------------------
        > *Yahoo! Groups Links*
        >
        > * To visit your group on the web, go to:
        > http://groups.yahoo.com/group/soaplite/
        >
        > * To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        > <mailto:soaplite-unsubscribe@yahoogroups.com?subject=Unsubscribe>
        >
        > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
        > Service <http://docs.yahoo.com/info/terms/>.
        >
        >
      • Alex Pena
        ... #!/usr/bin/perl -w use SOAP::Lite #trace= all , ; $proxy = http://web_service_here.com/WSDL ; $uri = HPD_Helpdesk_WSDL ; $header = SOAP::Header- name(
        Message 3 of 3 , May 12, 2005
        • 0 Attachment
          I use the following which adds it into the header :
          -------------------------------------------
          #!/usr/bin/perl -w
          use SOAP::Lite
          #trace=>'all',
          ;

          $proxy = 'http://web_service_here.com/WSDL';
          $uri = 'HPD_Helpdesk_WSDL';

          $header = SOAP::Header->name(
          'AuthenticationInfo' =>
          \SOAP::Header->value(
          SOAP::Header->name('userName' => "youruser")->type(''),
          SOAP::Header->name('password' => "yourpass")->type(''),
          )
          );

          $data = (SOAP::Data->name('Ticket' => "12345"));

          $soap = new SOAP::Lite(proxy=>$proxy,uri=>$uri,readable=>'true',);
          $result = $soap->OpGet($header,$data);

          if ($result->fault){
          print "-----------------------------------------\n";
          print "Fault :", $result->faultstring, "\n";
          print "Faultcode :",$result->faultcode, "\n";
          print "Faultdetail :", %{$result->faultdetail}, "\n";
          } else {
          foreach my $field ($result->valueof("//OpGetResponse")) {
          print "\n";
          foreach my $field_name (sort keys %{$field}) {
          print $field_name, ": '",
          $field->{$field_name}, "'\n";
          }
          print "\n";
          }
          }

          ----------------------------------------------------


          Soap call created:

          <SOAP-ENV:Envelope
          xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
          xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
          xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:xsd="http://www.w3.org/1999/XMLSchema"
          SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          <SOAP-ENV:Header>
          <AuthenticationInfo>
          <userName>testusera</userName>
          <password>testusera</password>
          </AuthenticationInfo>
          </SOAP-ENV:Header>
          <SOAP-ENV:Body>
          <namesp1:OpGet xmlns:namesp1="HPD_Helpdesk_WSDL">
          <Ticket xsi:type="xsd:string">12345</Assigned_To_Group>
          </namesp1:OpGet></SOAP-ENV:Body></SOAP-ENV:Envelope>



          Alex,


          On May 12, 2005, at 10:16 AM, Byrne Reese wrote:

          > What version of SOAP::Lite are you using? At first glance this looks
          > like a problem with SOAP::Lite - odd that noone has reported it  yet.
          >
          > Stephen Strudwick wrote:
          >
          > > Hi,
          > >
          > > I've run into a problem I cant solve, i'm trying to insert something
          > > like this:
          > >
          > >  
          > >
          > <AuthenticationInfo><userName>User</userName><password>Password</
          > password></AuthenticationInfo>
          > >
          > > into the clients header response for authentication.
          > >
          > > I can insert it without nesting like this:
          > >
          > > print $service->OpGetListADSL(
          > > SOAP:: Header->name('username' => 'user'),
          > > SOAP:: Header->name('password' => 'pass')
          > > );
          > >
          > > And that kind of works, producing:
          > >
          > >   <SOAP-ENV:Header>
          > >    <password xsi:type="xsd:string">steve</password>
          > >   </SOAP-ENV:Header>
          > >
          > > but puts the username in the body.. ?
          > >
          > > Then when I try and nest it in the same way as the SOAP::Data
          > example:
          > >
          > > print $service->OpGetListADSL(
          > >
          > > SOAP::Header
          > > -> name(AuthenticationInfo =>
          > >    \SOAP::Header->value(
          > > SOAP:: Header->name('username' => 'steve'),
          > > SOAP:: Header->name('password' => 'steve')))
          > >
          > > );
          > >
          > > it sticks it all in the body not the header:
          > >
          > > <SOAP-ENV:Body>
          > >   <OpGetListADSL xmlns="">
          > >   <AuthenticationInfo>
          > >   <username xsi:type="xsd:string">steve</username>
          > >   <password xsi:type="xsd:string">steve</password>
          > >    </AuthenticationInfo>
          > >    </OpGetListADSL>
          > > </SOAP-ENV:Body>
          > >
          > > I suspect I am misunderstanding how to do this, any pointers in the
          > right
          > > direction would be appreciated as I am getting very confused.
          > >
          > > -
          > > stephen strudwick
          > >
          > >
          > >
          > -----------------------------------------------------------------------
          > -
          > > *Yahoo! Groups Links*
          > >
          > >     * To visit your group on the web, go to:
          > >       http://groups.yahoo.com/group/soaplite/
          > >       
          > >     * To unsubscribe from this group, send an email to:
          > >       soaplite-unsubscribe@yahoogroups.com
          > >      
          > <mailto:soaplite-unsubscribe@yahoogroups.com?subject=Unsubscribe>
          > >       
          > >     * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
          > >       Service <http://docs.yahoo.com/info/terms/>.
          > >
          > >
          >
          >
          >
          > Yahoo! Groups Links
          > • To visit your group on the web, go to:
          > http://groups.yahoo.com/group/soaplite/
          >  
          > • To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >  
          > • Your use of Yahoo! Groups is subject to the Yahoo! Terms of
          > Service.
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.