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

SOAP::Lite can produce exact tag structure response?

Expand Messages
  • chriswhicks
    Is it possible to get SOAP::Lite to return an array that conforms to what folks have defined in a WSDL file? I m trying to get SOAP::Lite to produce something
    Message 1 of 1 , Sep 18, 2004
    • 0 Attachment
      Is it possible to get SOAP::Lite to return an array that conforms to
      what folks have defined in a WSDL file? I'm trying to get SOAP::Lite
      to produce something like:

      <?xml version="1.0"?>
      <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/19
      <namesp1:doGetClientListResponse xmlns:namesp1="urn:iReserve">
      <records xsi:type="typens:ClientRecordList">
      <ClientArray SOAP-ENC:arrayType="typens:ClientRecord[2]"
      <ClientRecord xsi:type="typens:ClientRecord">
      <id xsi:type="xsd:Int">1</id>
      <name xsi:type="xsd:String">Bob's Low Cost Insurance</name>
      <ClientRecord xsi:type="typens:ClientRecord">
      <id xsi:type="xsd:Int">2</id>
      <name xsi:type="xsd:String">Tom's Great Insurance</name>

      using this routine

      sub doGetClientList {
      # deal with arguments
      # warn Dumper(\@_);
      shift; # remove class name
      my $cookie = shift; # unused currently

      # talk to database
      my $dbh = _dbh();
      my $sql = "select * from client";
      my $sth = $dbh->prepare($sql) or die "prep $sql";
      $sth->execute() or die "exec $sql";

      my $clientlist = [];
      while (my $row = $sth->fetchrow_hashref()) {
      # my $soapclientrec = SOAP::Data->new();
      # $soapclientrec->name('clientrecord');
      # $soapclientrec->type('typens:ClientRecord');

      warn "PID=$$ " . Dumper($clientlist);
      # warn "PID=$$ clients=(" . join(',',@$clientlist) . ")";
      # warn "here";

      # return ({records=>$clientlist});

      # return SOAP::Data->name("records" =>
      # SOAP::Data->value( SOAP::Data->name("client" =>
      # ->type("ClientRecord")
      # )
      # )->type("ClientRecordArray");

      my @soaprecs;
      foreach my $row (@$clientlist) {
      foreach my $key (keys %$row) {
      unless (defined $row->{$key}) {
      $row->{$key} = '';
      my $clirec = SOAP::Data->new();

      #warn Dumper(\@soaprecs);

      my $reccount = scalar(@soaprecs);

      my $clientarray = SOAP::Data->new();
      # $clientarray->value(@soaprecs);
      $clientarray->value('blah blah');

      # 'xsi:type' => 'SOAP-ENC:Array',

      my $records = SOAP::Data->new();

      # warn "about to encode array";
      # use warnings;

      # my $serializer = SOAP::Serializer->new();
      # warn "got serializer";
      # my $records =
      # my $records =

      # warn Dumper($records);

      return $records;

      I left the various incantations I've tried commented out. So my
      questions would be these:

      1) Is it possible to use SOAP::Lite to produce that SOAP Message

      2) If it won't do it natively how can I override it's output so I can
      wack it into shape by hand?

      3) Is there any Perl SOAP implementation which validates what the
      server side is doing against a given WSDL?

      4) Should I just give up on SOAP and do something else to move
      arbitarily complex data structures back and forth between a client
      written in Mozilla XUL and a server written in Perl?

      Any guidance would be greatly appreciated.
    Your message has been successfully submitted and would be delivered to recipients shortly.