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

RE: [soaplite] Re: Strange string parameter corruption with recen t pe rl 5.6 to 5.8 upgrade

Expand Messages
  • B R
    I have tried to override the as_string to do the utf8::downgrade, but SOAP::Lite always uses the SOAP::XMLSchema1999::Deserializer instead. Basically, I want
    Message 1 of 5 , Jan 20, 2003
      I have tried to override the as_string to do the
      utf8::downgrade, 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, the builtin is
      always used.


      How do I override the builtin as_string deserializer?


      --- Paul Kulchenko <paulclinger@...> wrote:
      > > parameters. But, this is a pain. Is there a way
      > to
      > > make sure all parameters are not utf-8? I tried
      > both
      > > 'no utf8' as well as setting
      > > $SOAP::Constants::DO_NOT_USE_ENCODING.
      >
      > There is nothing in SOAP::Lite code that makes it
      > utf-8 encoded;
      > that's done by XML::Parser. From "Programming Web
      > Services with Perl"
      >
      > The XML::Parser module that is used by default in
      > SOAP::Lite always
      > returns data using UTF-8 encoding. There is one
      > thing to watch for:
      > returned strings are always encoded as UTF-8, but
      > they may not be
      > recognized as UTF-8 strings by Perl, which might be
      > important in some
      > cases.
      > The XML::Parser module (Version 2.28 and later) tags
      > generated
      > strings as UTF-8 in Perl 5.6 and beyond.
      >
      > Probably there is an option to disable that, but I
      > don't have any
      > specific details on that.
      >
      > > only think to do utf8::downgrade($var) on the
      > It might be possible to install a new as_string
      > handler and add this
      > transformation there. Let me know if you want to do
      > something like
      > that.
      >
      > Best wishes, Paul.
      >
      > --- B R <b1v1r@...> wrote:
      > > Excellent call, thank you!
      > >
      > > I added a:
      > >
      > > use Devel::Peek qw(Dump);
      > >
      > > ...
      > >
      > > print "dn='$dn'\n";
      > > Dump($dn);
      > > print "password='$password'\n";
      > > Dump($password);
      > >
      > > and sure enough I get UTF8 flags for only the SOAP
      > > passed parameters (see below). However, offhand I
      > can
      > > only think to do utf8::downgrade($var) on the
      > > parameters. But, this is a pain. Is there a way
      > to
      > > make sure all parameters are not utf-8? I tried
      > both
      > > 'no utf8' as well as setting
      > > $SOAP::Constants::DO_NOT_USE_ENCODING.
      > >
      > > Output with SV Dumping...
      > >
      > > Contact to SOAP server at http://localhost:8580/
      > > dn='uupid=baduser,ou=accounts,dc=vt,dc=edu'
      > > SV = PV(0x87811b4) at 0x814dbbc
      > > REFCNT = 1
      > > FLAGS = (POK,pPOK)
      > > PV = 0x87b27c8
      > > "uupid=baduser,ou=accounts,dc=vt,dc=edu"\0
      > > CUR = 38
      > > LEN = 39
      > > password='badpass'
      > > SV = PV(0x8799810) at 0x83c42a4
      > > REFCNT = 1
      > > FLAGS = (POK,pPOK)
      > > PV = 0x87a4168 "badpass"\0
      > > CUR = 7
      > > LEN = 8
      > > Creating LDAP handle...OK -
      > > Net::LDAP::Extension=HASH(0x87930f4)
      > > Binding with:
      > > dn='uupid=baduser,ou=accounts,dc=vt,dc=edu'
      > > password='badpass'
      > > LDAP bind() results: code='49' codetext='Invalid
      > > credentials' servererr=''
      > > dn='uupid=baduser,ou=accounts,dc=vt,dc=edu'
      > > SV = PV(0x87811b4) at 0x814dbbc
      > > REFCNT = 1
      > > FLAGS = (POK,pPOK,UTF8)
      > > PV = 0x87b27c8
      > > "uupid=baduser,ou=accounts,dc=vt,dc=edu"\0 [UTF8
      > > "uupid=baduser,ou=accounts,dc=vt,dc=edu"]
      > > CUR = 38
      > > LEN = 39
      > > password='badpass'
      > > SV = PV(0x8799810) at 0x83c42a4
      > > REFCNT = 1
      > > FLAGS = (POK,pPOK,UTF8)
      > > PV = 0x87a4168 "badpass"\0 [UTF8 "badpass"]
      > > CUR = 7
      > > LEN = 8
      > > Creating LDAP handle...OK -
      > > Net::LDAP::Extension=HASH(0x8791f60)
      > > Binding with:
      > > dn='uupid=baduser,ou=accounts,dc=vt,dc=edu'
      > > password='badpass'
      > > LDAP bind() results: code='1' codetext='I/O Error
      > '
      > > servererr='I/O Error '
      > >
      > >
      > >
      > >
      > > --- Keanan Smith <KSmith@...> wrote:
      > > > If the actual strings themselves are the same (a
      > la
      > > > 'eq') then there are two
      > > > other places I can think to check. One is that
      > you
      > > > are passing a reference
      > > > that isn't blessed into the same pacakge, and
      > the
      > > > second (The one I'm
      > > > betting is the case) is that a flag (Either
      > Integer
      > > > or more likely UTF-8) on
      > > > the string isn't the same.
      > > >
      > > > -----Original Message-----
      > > > From: B R [mailto:b1v1r@...]
      > > > Sent: Friday, January 17, 2003 3:21 PM
      > > > To: soaplite@yahoogroups.com
      > > > Subject: RE: [soaplite] Re: Strange string
      > parameter
      > > > corruption with
      > > > recen t pe rl 5.6 to 5.8 upgrade
      > > >
      > > >
      > > > Yep, I did that too. Perl compares them as
      > equal,
      > > > yet
      > > > LDAP seems to see a difference. It is a very
      > > > strange
      > > > problem.
      > > >
      > > > I have done everything I can think of to verify
      > that
      > > > the string passed is what I really passed it.
      > Even
      > > > in
      > > > the SOAP XML, you can see that there are no
      > > > extra/changed/missing characters. From a perl
      > view,
      > > > they are the same strings, but LDAP complains
      > about
      > > > the one passed via SOAP, but not the hard-coded
      > > > server
      > > > version. So, It must be somewhere internal to
      > perl
      > > > (Perhaps only seen by the XS stuff that I think
      > LDAP
      > > > is using).
      > > >
      > > > I am really just looking to see if someone can
      > > > verify
      > > > this or perhaps enlighten me with a possible
      > cause
      > > > or
      > > > a place to look for more info. Any suggestions
      > > > where
      > > > to go from here are welcome.
      > > >
      > > > Thanks,
      > > > -Brian
      > > >
      > > >
      > > > --- Sean.Meisner@... wrote:
      > > > > Try a test comparing the strings you get over
      > the
      > > > > network to what
      > > > > you think they should be, something like:
      > > >
      > >
      > > __________________________________________________
      > > Do you Yahoo!?
      > > Yahoo! Mail Plus - Powerful. Affordable. Sign up
      > now.
      > > http://mailplus.yahoo.com
      > >
      > > ------------------------ Yahoo! Groups Sponsor
      > >
      > > 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!?
      > Yahoo! Mail Plus - Powerful. Affordable. Sign up
      > now.
      > http://mailplus.yahoo.com


      __________________________________________________
      Do you Yahoo!?
      Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
      http://mailplus.yahoo.com
    Your message has been successfully submitted and would be delivered to recipients shortly.