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

parsing undeclared array / patch proposal

Expand Messages
  • wackerl@iatms11.iatm.tuwien.ac.at
    no attachments. oh, all right... ... #!/usr/bin/perl use LWP::UserAgent; $payload =
    Message 1 of 2 , Dec 29, 2003
    • 0 Attachment
      no attachments. oh, all right...

      ----8<---- send_file.pl ----8<----

      #!/usr/bin/perl

      use LWP::UserAgent;

      $payload = <<eoXML;
      <?xml version='1.0' encoding='UTF-8'?>
      <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:Body>
      <namesp1:doTransaction xmlns:namesp1="http://ella.lokales.netz/afz">
      <AFZ_MELDUNG>
      eoXML

      open( XML, '<Beispiel.xml' ) || die $!;
      undef $/;
      $data = <XML>;
      close XML;

      $payload .= $data;
      $payload .= <<eoXML;
      </AFZ_MELDUNG>
      </namesp1:doTransaction>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      eoXML

      open( XML, '>afz_meldung_debug.xml' );
      print XML $payload;
      close XML;

      print 'payload length: ', length( $payload ), "\n";

      $ua = LWP::UserAgent->new;
      $header = new HTTP::Headers('Content-Type'=>'text/xml');
      $request = new HTTP::Request(
      'POST',
      'http://ella.lokales.netz/pub/soap/cgi-bin/afz_server.pl',
      $header,
      $payload
      );
      $response = $ua->request($request);
      $content = $response->content;
      #$content =~ s|</([\s\w]+)>|</$1>\n|g;
      $content =~ s|(?<!=)>|>\n|g;

      print "\n\ncode: ", $response->code;
      print "\n\nmessage: ", $response->message;
      print "\n\nheader: ", $response->header;
      print "\n\ncontent: ", $content;
      print "\n";


      ----8<---- afz_server.pl ----8<----

      #!/usr/bin/perl -w

      $SOAP::Constants::DO_NOT_USE_XML_PARSER = 1;
      my $server = SOAP::Transport::HTTP::CGI
      -> objects_by_reference( 'afz' )
      -> dispatch_to('afz')
      -> handle()
      ;

      package afz;

      use vars qw(@ISA $iTANSequence);
      BEGIN
      {
      @ISA = qw(SOAP::Server::Parameters);
      }
      use strict;
      use Data::Dumper;

      sub debug
      {
      my( $self, @params ) = @_;

      my $s = join( '~~~', 's', 'self=', $self,
      'params:', @params,
      '#0=', %{$params[0]}, 'e' );

      return
      SOAP::Data->name( Params => $s ),
      SOAP::Data->name( PerlVersion => $] ),
      SOAP::Data->name( INC => [@INC] )
      ;
      }

      sub doTransaction
      {
      my( $self, @params ) = @_;
      my $data = \%{$params[0]};
      my @aErrorCodes;

      return
      SOAP::Data->type('string')->name('xx2'=>Data::Dumper->Dumper($data));

      }

      1;


      ----8<---- Beispiel.xml ----8<----

      <VERSION>1.1</VERSION>
      <TAN>314159265359</TAN>
      <SENDER>
      <IDENTIFICATION>
      <Value>1234567890123</Value>
      <Type>EAN</Type>
      <Authority/>
      </IDENTIFICATION>
      <PARTYTYPE>LEGAL</PARTYTYPE>
      <PARTYNAME1>Testfirma</PARTYNAME1>
      <PARTYNAME2/>
      <PARTYNAME3/>
      <PARTYNAME4/>
      <ADRESS>
      <PARTYPOB/>
      <PARTYSTR1>Hauptstrasse</PARTYSTR1>
      <PARTYSTR2/>
      <PARTYSTRNUM>1</PARTYSTRNUM>
      <PARTYSTRNRX/>
      <PARTYCOUNTRY>AT</PARTYCOUNTRY>
      <PARTYPOSTCODE>1010</PARTYPOSTCODE>
      <PARTYTOWN1>Wien</PARTYTOWN1>
      <PARTYTOWN2/>
      </ADRESS>
      <PARTYCONTTEL/>
      <PARTYCONTFAX/>
      <PARTYCONTMOBILE/>
      <PARTYCONTEM/>
      </SENDER>
      <BERICHTSJAHR>2003</BERICHTSJAHR>
      <MELDENDER>
      <IDENTIFICATION>
      <Value>1234567890123</Value>
      <Type>EAN</Type>
      </IDENTIFICATION>
      <PARTYTYPE>LEGAL</PARTYTYPE>
      <PARTYNAME1>Testfirma</PARTYNAME1>
      <ADRESS>
      <PARTYSTR1>Hauptstrasse</PARTYSTR1>
      <PARTYSTRNUM>1</PARTYSTRNUM>
      <PARTYCOUNTRY>AT</PARTYCOUNTRY>
      <PARTYPOSTCODE>1010</PARTYPOSTCODE>
      <PARTYTOWN1>Wien</PARTYTOWN1>
      </ADRESS>
      </MELDENDER>
      <HSTUEB>
      <AFZ_UEBERNAHME>
      <AFZ>
      <MARKE>VW</MARKE>
      <TYPE>Golf</TYPE>
      <BAUJAHR>2000</BAUJAHR>
      <SENDERID>1</SENDERID>
      </AFZ>
      <UEBERNAME_DATUM>2003-01-01</UEBERNAME_DATUM>
      <UEBERGEBER>
      <PARTYTYPE>NATURAL</PARTYTYPE>
      <PARTYNAME1>Zola</PARTYNAME1>
      <PARTYNAME2/>
      <PARTYNAME3/>
      <PARTYNAME4/>
      <ADRESS>
      <PARTYPOB/>
      <PARTYSTR1>Boulevard</PARTYSTR1>
      <PARTYSTR2/>
      <PARTYSTRNUM>1</PARTYSTRNUM>
      <PARTYSTRNRX/>
      <PARTYCOUNTRY>FR</PARTYCOUNTRY>

      <PARTYPOSTCODE>12345</PARTYPOSTCODE>
      <PARTYTOWN1>Paris</PARTYTOWN1>
      <PARTYTOWN2/>
      </ADRESS>
      <PARTYCONTTEL/>
      <PARTYCONTFAX/>
      <PARTYCONTMOBILE/>
      <PARTYCONTEM/>
      </UEBERGEBER>
      </AFZ_UEBERNAHME>
      <AFZ_UEBERNAHME>
      <AFZ>
      <MARKE>AUDI</MARKE>
      <TYPE>xyz 666</TYPE>
      <BAUJAHR>2000</BAUJAHR>
      <SENDERID>2</SENDERID>
      </AFZ>
      <UEBERNAME_DATUM>2003-02-02</UEBERNAME_DATUM>
      <UEBERGEBER>
      <PARTYTYPE>NATURAL</PARTYTYPE>
      <PARTYNAME1>Hugo</PARTYNAME1>
      <ADRESS>
      <PARTYSTR1>Boulevard</PARTYSTR1>
      <PARTYSTRNUM>1</PARTYSTRNUM>
      <PARTYCOUNTRY>FR</PARTYCOUNTRY>

      <PARTYPOSTCODE>12345</PARTYPOSTCODE>
      <PARTYTOWN1>Paris</PARTYTOWN1>
      </ADRESS>
      </UEBERGEBER>
      </AFZ_UEBERNAHME>
      <AFZ_UEBERNAHME>
      <AFZ>
      <MARKE>HONDA</MARKE>
      <TYPE>S2000</TYPE>
      <BAUJAHR>1990</BAUJAHR>
      <SENDERID>2</SENDERID>
      </AFZ>
      <UEBERNAME_DATUM>2003-03-03</UEBERNAME_DATUM>
      <UEBERGEBER>
      <PARTYTYPE>NATURAL</PARTYTYPE>
      <PARTYNAME1>Hugo</PARTYNAME1>
      <ADRESS>
      <PARTYSTR1>Boulevard</PARTYSTR1>
      <PARTYSTRNUM>1</PARTYSTRNUM>
      <PARTYCOUNTRY>FR</PARTYCOUNTRY>

      <PARTYPOSTCODE>12345</PARTYPOSTCODE>
      <PARTYTOWN1>Paris</PARTYTOWN1>
      </ADRESS>
      </UEBERGEBER>
      </AFZ_UEBERNAHME>
      </HSTUEB>
    Your message has been successfully submitted and would be delivered to recipients shortly.