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

4160Re: Using SOAP to transfer XML document

Expand Messages
  • nonsolosoft
    Nov 6, 2004
      Hello,

      the following program now makes the SOAP call and
      receives the answer.

      1) Can I avoid to use LWP::UserAgent to send the $soap_request?
      2) If SOAP::Lite is not able to send a such raw $soap_request,
      can I reinsert the $soap_response into SOAP::Lite to use
      its deserializer and other features?

      #!/usr/bin/perl

      use SOAP::Lite;
      use LWP::UserAgent;

      $var4 = SOAP::Data
      ->name('SBNMarc' => {
      'SbnUser'=> {
      Biblioteca => 'EXXAMM',
      UserId => '010047'
      },
      SbnMessage=> {
      SbnRequest => \SOAP::Data->name('Cerca'=>
      {
      CercaElementoAut => {
      CercaDatiAut => {
      tipoAuthority=>AU,

      canaliCercaDatiAut => {

      T001=>'CFIV006324'
      }
      }
      }
      } )->attr({maxRighe=>"15",
      numPrimo=>"1", tipoOrd=>"1", tipoOutput=\>"000"})
      }
      })->attr({'schemaVersion'=>"1.07",
      'xmlns:xsi'=>"http://www.w3.org/2001/XMLSchema-instance",
      'xsi:noNamespaceSchemaLocation'=>"SBNMarcv107.xsd"});



      $soap_request = SOAP::Lite->serializer->envelope(method=>'freeform',
      $var4);

      $soap_request =~ s/<freeform>// ;
      $soap_request =~ s!</freeform>!! ;


      my $ua = LWP::UserAgent->new();
      my $req = HTTP::Request->new(POST => $SBN::uri);
      $req->authorization_basic($SBN::login, $SBN::password);

      $req->content_type('text/xml');
      $req->content($soap_request);
      my $res = $ua->request($req);
      my $soap_response = $res->as_string;

      print $soap_response->content;






      Best regards, \fer
    • Show all 8 messages in this topic