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

Re: [soaplite] How to add authHeader to Soap Request

Expand Messages
  • Tobias Richter
    Hi *, sorry, about Double posting - I thought that my first message hasn t transmitted correctly. ... my $SessionWebServicesoap = SOAP::Lite - readable(1)
    Message 1 of 2 , Dec 12, 2011
    • 0 Attachment
      Hi *,

      sorry, about Double posting - I thought that my first message hasn't
      transmitted correctly.

      In the meantime I was able to solve the problem by myself:

      ---snip---
      my $SessionWebServicesoap = SOAP::Lite

      ->readable(1)

      ->proxy($SessionWebServiceURI)

      ->uri($SessionWebServiceURI)

      ;

      $SessionWebServicesoap->autotype(0);

      my $SessionWebServicesoapSerializer = $SessionWebServicesoap->serializer();

      $SessionWebServicesoapSerializer->register_ns(
      'http://ws.polarion.com/session', 'ns1' );



      my $ProjectWebServicesoap = SOAP::Lite

      ->readable(1)

      ->proxy($ProjectWebServiceURI)

      ->uri($ProjectWebServiceURI)

      ;

      $ProjectWebServicesoap->autotype(0);

      my $ProjectWebServicesoapSerializer = $ProjectWebServicesoap->serializer();

      $ProjectWebServicesoapSerializer->register_ns(
      'http://ws.polarion.com/session', 'ns1' );





      my $TrackerWebServicesoap = SOAP::Lite

      ->readable(1)

      ->proxy($TrackerWebServiceURI)

      ->uri($TrackerWebServiceURI)

      ;

      $TrackerWebServicesoap->autotype(0);

      my $TrackerWebServicesoapSerializer = $TrackerWebServicesoap->serializer();

      $TrackerWebServicesoapSerializer->register_ns(
      'http://ws.polarion.com/session', 'ns1' );



      my $response;



      print "\n";



      #get session

      my $session = $SessionWebServicesoap->logIn(

      SOAP::Data->name('userName')->value($user),

      SOAP::Data->name('password')->value($password)

      );

      my $sessionID = $session->{'_content'}[2][0][4]{'sessionID'};

      print "session is: ".$sessionID."\n";



      my $authHeader = SOAP::Header->name('ns1:sessionID')->value($sessionID);



      $response = $TrackerWebServicesoap->getWorkItemById("projectname",
      "TEST-1", $authHeader);

      die $response->faultstring if ($response->fault);

      print Dumper($response->result);


      ---snap---

      The important stuff is the "register_ns" and the "$authheader" part.
      Now it works perfect and I can go forward with this script... :)

      Maybe somebody will find this solution useful in future.


      Best regards,
      Tobias
    Your message has been successfully submitted and would be delivered to recipients shortly.