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

How to add header to my client script

Expand Messages
  • Kamlesh
    My client code is: use SOAP::Lite +trace = debug ; my $soap = SOAP::Lite - service( http://hdwebqa/arsys/WSDL/corphdqa/UserLoginName ); my @som =
    Message 1 of 2 , May 29, 2003
    • 0 Attachment
      My client code is:

      use SOAP::Lite +trace => 'debug';


      my $soap = SOAP::Lite
      ->service('http://hdwebqa/arsys/WSDL/corphdqa/UserLoginName');

      my @som = $soap->OpGetByLastNameMany(SOAP::Data->name("Last_Name"
      => 'Smith'));

      $rec = scalar @som;
      $fld = scalar( keys %{$som[0]});
      print "found $rec records and $fld fields\n";

      #loop through records
      foreach my $x (@som) {
      #loop through fields for each record
      foreach my $z (keys %$x) {
      printf "$z: $x->{$z}; "; #$z is the key (field name); $x->{$z}
      is the value in field $z
      }
      print "\n";
      }

      #end of script

      I need to add soap header to this. There are two parameters in
      header are required. userName and password.

      How do I do this????

      Here is the sample of server header msg that serverside expects.

      SOAP Request
      ===========
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Header>
      <AuthenticationInfo xmlns="urn:a">
      <userName>Demo</userName>
      <password>test</password>
      <authentication />
      <locale />
      <timeZone />
      </AuthenticationInfo>
      </soap:Header>
      <soap:Body>
      ::: stuff goes here.
      </soap:Body>
      </soap:Envelope>
    • Randy J. Ray
      ... Just as you used the SOAP::Data class to create the data element you pass, use the SOAP::Header class to create the elements that should be headers in the
      Message 2 of 2 , May 29, 2003
      • 0 Attachment
        > I need to add soap header to this. There are two parameters in
        > header are required. userName and password.
        >
        > How do I do this????

        Just as you used the SOAP::Data class to create the data element you pass, use
        the SOAP::Header class to create the elements that should be headers in the
        SOAP message. Then pass them as arguments to the call, along with the
        SOAP::Data value. The serializer recognizes objects that are (or derive from)
        SOAP::Header and handle them correctly.

        Randy
        --
        rjray@... http://www.rjray.org http://www.svsm.org

        Any spammers auto-extracting addresses from this message will definitely want
        to include uce@... and report@...
      Your message has been successfully submitted and would be delivered to recipients shortly.