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

Overriding default as_sring deserializer?

Expand Messages
  • b1v1r <b1v1r@yahoo.com>
    I asked this previously, but never got an answer. So, I ll try one last time with a better subject... I have tried to override the as_string deserializer to
    Message 1 of 3 , Feb 14, 2003
    • 0 Attachment
      I asked this previously, but never got an answer. So, I'll try one
      last time with a better subject...

      I have tried to override the as_string deserializer to do a
      utf8::downgrade on all strings (this stems from LDAP having some
      problems with UTF-8 strings), but SOAP::Lite always uses the
      SOAP::XMLSchema1999::Deserializer instead. Basically, I want to do
      this in a subclass of SOAP::Deserializer (say My::Deserializer) and
      install the subclass as the deserializer in the server:

      # In My::Deserializer:
      ...
      sub as_string {
      my $string = SUPER::as_string(@_);
      utf8::downgrade($string);
      return $string;
      }
      ...

      Then do this in the server:

      $daemon = SOAP::Transport::HTTP::Daemon->new (
      'LocalAddr' => '127.0.0.1',
      'LocalPort' => 8580,
      'ReuseAddr' => 1,
      )
      -> deserializer(My::SOAPDeserializer->new)
      -> dispatch_to('TESTAPI')
      ;


      I have installed many other deserializers for my own types in
      My::Deserializer and they work fine, but when I try to override a
      builtin type (string), the builtin is always used.

      How do I override the builtin as_string deserializer?
    • Duncan Cameron
      ... The as_string method isn t actually in the SOAP::Deserializer package which you over-ride, it is in the SOAP::XMLSchema1999::Deserializer or wherever
      Message 2 of 3 , Feb 14, 2003
      • 0 Attachment
        On 2003-02-14 b1v1r <b1v1r wrote:
        >I asked this previously, but never got an answer. So, I'll try one
        >last time with a better subject...
        >
        >I have tried to override the as_string deserializer to do a
        >utf8::downgrade on all strings (this stems from LDAP having some
        >problems with UTF-8 strings), but SOAP::Lite always uses the
        >SOAP::XMLSchema1999::Deserializer instead. Basically, I want to do
        >this in a subclass of SOAP::Deserializer (say My::Deserializer) and
        >install the subclass as the deserializer in the server:
        >
        ># In My::Deserializer:
        >....
        >sub as_string {
        > my $string = SUPER::as_string(@_);
        > utf8::downgrade($string);
        > return $string;
        >}
        >....
        >
        >Then do this in the server:
        >
        >$daemon = SOAP::Transport::HTTP::Daemon->new (
        > 'LocalAddr' => '127.0.0.1',
        > 'LocalPort' => 8580,
        > 'ReuseAddr' => 1,
        >)
        >-> deserializer(My::SOAPDeserializer->new)
        >-> dispatch_to('TESTAPI')
        >;
        >
        >
        >I have installed many other deserializers for my own types in
        >My::Deserializer and they work fine, but when I try to override a
        >builtin type (string), the builtin is always used.
        >
        >How do I override the builtin as_string deserializer?
        >

        The as_string method isn't actually in the SOAP::Deserializer package which
        you over-ride, it is in the SOAP::XMLSchema1999::Deserializer or wherever
        package. You could try redefining the method like:

        package SOAP::XMLSchema1999::Deserializer;

        sub as_string {

        # your code

        }

        package main;
        ..


        Regards,
        Duncan Cameron
      • b1v1r <b1v1r@yahoo.com>
        Right, I understand that as_string() is really from SOAP::XMLSchema1999::Deserializer (it was stated in my message), but I am not supposed to (have) know that.
        Message 3 of 3 , Feb 14, 2003
        • 0 Attachment
          Right, I understand that as_string() is really from
          SOAP::XMLSchema1999::Deserializer (it was stated in my message), but I
          am not supposed to (have) know that. The SOAP::Deserializer is there
          so I don't have to figure out which
          SOAP::XMLSchema*::Derserializer::as_string() to call.

          Is there not an easy way to do this without having to override *all*
          the SOAP::XMLSchema*::Derserializer::as_string() methods? If another
          one is added, then my app breaks, which is not good.

          --- In soaplite@yahoogroups.com, Duncan Cameron <dcameron@b...> wrote:
          ... snip ...
          >
          > The as_string method isn't actually in the SOAP::Deserializer
          package which
          > you over-ride, it is in the SOAP::XMLSchema1999::Deserializer or
          wherever
          > package. You could try redefining the method like:
          >
          > package SOAP::XMLSchema1999::Deserializer;
          >
          > sub as_string {
          >
          > # your code
          >
          > }
          >
          > package main;
          > ..
          >
          >
          > Regards,
          > Duncan Cameron
        Your message has been successfully submitted and would be delivered to recipients shortly.