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

Re: [soaplite] Q: SOAP::Lite, Deserializer

Expand Messages
  • Paul Kulchenko
    Hi, Jens-Uwe! ... You don t need to do anything there: my $jdata = SOAP::Lite - proxy(...) - uri(...) - something(...) - result; should return JData
    Message 1 of 2 , Aug 14, 2001
    • 0 Attachment
      Hi, Jens-Uwe!

      > How can i implement a deserializer to do that, or is there
      > another "correct"
      > approach to achieve this? or do i simply use it as the hash
      > returned by
      > soap-response->paramsall ?? But then, how can i access methods
      > defined
      > in the JData-perl-package (e.g. JData->new->jmeth(..)) ??
      You don't need to do anything there:

      my $jdata = SOAP::Lite
      -> proxy(...)
      -> uri(...)
      -> something(...)
      -> result;

      should return JData object, so later you can just do

      $jdata->jmeth; # or any other method assuming you have
      'use JData' or package declaration somewhere before.

      > How can i add a "as_..." method to SOAP::Lite to deserialize that
      > correctly ??
      Yes, you can. Take a look into examples/customschema.pl that
      describes how to create as_.. handler and bind it to specific
      schema/namespace. If you want to handle this type in ANY namespace,
      you need to put it into SOAP::Deserializer namespace
      (SOAP::Deserializer::as_...., or inherit your own deserializer if you
      don't want to pollute namespace). Hope it helps.

      Best wishes, Paul.

      --- Jens-Uwe Gaspar <jug@...> wrote:
      > Hi,
      >
      > i have a SOAP-Server (Java-classes under tomcat) and use SOAP::Lite
      > for a Perl-client. For simple/compound types (float/string/int,
      > hash)
      > it works very well,
      >
      > Question 1:
      > On server-side (Java) i have two classes 'JData' & 'AData':
      >
      > class AData {
      > private String astr;
      > // Bean-methods (set/get) for BeanSerializer
      > }
      >
      > class JData {
      > private AData adata;
      > private String s1;
      > private int i1;
      > // Bean-methods (set/get) for BeanSerializer
      > }
      >
      > As SOAP-output from server i will get (return-part):
      >
      > <return xmlns:ns2=".." xsi:type="ns2:JData">
      > <s1 xsi:type="xsd:string">String1</s1>
      > <i1 xsi:type="xsd:int">2001</i1>
      > <adata xsi:type="ns2:AData">
      > <astr xsi:type="xsd:string">StringA</astr>
      > </adata>
      > </return>
      >
      > Now in the Perl-Client i want this nested structure be
      > transformed
      > in an equivalent "Perl-class":
      >
      > package JData;
      > sub new {
      > $c=$_[0]->class; $s={ adata => AData->new, s1 => .. };
      > bless $self,$c; $s
      > }
      > sub jmeth { $s=shift; ... do something ... }
      >
      > package AData;
      > sub new { $c=$_[0]->class; $s={ 'astr' => .. }; bless $self,$c;
      > $s };
      >
      > According output (by Data::Dumper):
      >
      > bless( {
      > 'adata' => bless( {
      > 'astr' => 'StringA',
      > }, 'AData' ),
      > 's1' => 'String1',
      > 'i1' => 2001,
      > }, 'JData' )
      >
      > How can i implement a deserializer to do that, or is there
      > another "correct"
      > approach to achieve this? or do i simply use it as the hash
      > returned by
      > soap-response->paramsall ?? But then, how can i access methods
      > defined
      > in the JData-perl-package (e.g. JData->new->jmeth(..)) ??
      >
      >
      >
      > Question 2:
      >
      > If i have a field in Java-class of type 'java.sql.Timestamp':
      >
      > class JData2 {
      > private String s1;
      > private java.sql.Timestamp ts;
      > // Bean-methods (set/get) for BeanSerializer
      > }
      >
      > and having a Java-Serializer for it with its own xml-type.
      > How can i add a "as_..." method to SOAP::Lite to deserialize that
      > correctly ??
      > Or how can i handle this on another way?
      >
      >
      > Yours sincerely,
      >
      > JUG
      >
      >
      ________________________________________________________________________
      > Jens-Uwe Gaspar Schlund + Partner AG
      > E-Mail: jug@... Erbprinzenstr. 4 - 12
      > Tel. +49-721-91374-50 76133 Karlsruhe,
      > Germany
      > Fax +49-721-91374-20 http://www.schlund.de
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Make international calls for as low as $.04/minute with Yahoo! Messenger
      http://phonecard.yahoo.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.