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

1631Can't Pass Objects to non-Soap::Lite servers

Expand Messages
  • gwzoller
    Jun 18 1:01 PM

      Does anyone have an example of how to pass an object
      from Perl to a non-Soap::Lite server?

      Not sure, but I think my problem is that I'm not
      "packaging" up into XML what my server expects for
      an object.

      Anyone have any ideas?
      Thanks in advance.

      My client snippet: (using autodispatch)

      # Doesn't work!
      my $name = SOAP::Data->type(string=>'Greg')->name('name');
      my $balance = SOAP::Data->type(float=>100.51)->name('balance');
      my $id = SOAP::Data->type(int=>5)->name('id');
      my %z;
      $z{'name'} = $name;
      $z{'balance'} = $balance;
      $z{'id'} = $id;
      my $var = SOAP::Data->type('Hey' => \%z)->name('Hey');

      # Make server call. In Java: void showHey(Hey heyObj);
      showHey( $var );

      On the server side I have a trivial Java object:

      public class Hey implements java.io.Serializable
      private String name = null;
      private double balance = 0.0;
      private int id = 0;

      public void setName( String name ) { this.name = name; }
      public void setBalance( double balance )
      { this.balance = balance; }
      public void setId( int id ) { this.id = id; }

      public String getName() { return name; }
      public double getBalance() { return balance; }
      public int getId() { return id; }

      I'm using the Java GLUE library.