Guy,

Where is the code that encodes the method call into an xml document and
decodes the xml document into a method call?

Thanks,
Bryan

-----Original Message-----
From: Guy McArthur [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 12, 2001 5:35 PM
To: [EMAIL PROTECTED]
Subject: Re: xml schemas?


Perl's SOAP::Lite can deserialize beans.

Example:

A very simple bean class:

// Temperature.java
package test;

public class Temperature {
  private double temp;

  public Temperature() {
    temp = 0d;
  }

  public double getTemperature() {
    return temp;
  }

  public void setTemperature(double temp) {
    this.temp = temp;
  }
}

And a class containing a method to return an instance:

// TempServer.java
package test;

public class TempServer {
  public Temperature getTemp() {
        return new Temperature();
  }
}

Deployed as "urn:Temp".

Perl client:

# demo.pl
use SOAP::Lite;
use Data::Dumper;

# Connect to the service
my $soap = SOAP::Lite
     -> uri('urn:Temp')
     -> proxy('http://myserver.com/soap/servlet/rpcrouter');

# Call the method
my $result = $soap->getTemp();

# Check for error
unless ($result->fault) {
    # Fetch the JavaBean data
    my $object = $result->result();
    # Print the data contained in it
    print $$object{temperature}, "\n";
    print Dumper($object);
} else {
    die $result->faultstring;
}

If you use Data::Dumper to look at the $object you can see that it is an
instance of test.Temperature, and it's a hash (all objects in Perl are)
mapping the instance variable to a value. The output is:

0.0
$VAR1 = bless( {
                 'temperature' => '0.0'
               }, 'test.Temperature' );


So, really a trivial demo.



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.303 / Virus Database: 164 - Release Date: 11/24/2001

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.303 / Virus Database: 164 - Release Date: 11/24/2001

Reply via email to