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

4249Method calls failing due to malformed utf-8?

Expand Messages
  • Roger
    Dec 14, 2004
    • 0 Attachment
      Hi Group - boy am I glad I've found you guys!

      I'm interfacing to a third party web service using SOAP::Lite and
      have run into a problem with my method calls failing on certain
      requests.

      The code fragment I use is like this;

      my $method = SOAP::Data->name('GetInformation') ->attr({xmlns
      => 'http://someservice/soap/'});

      my $result = $soap->call($method => @params);

      and it is this method call that is sometimes failing - depending on
      the parameters I pass. Oh the 3rd party is a .NET service but I
      believe I have accomodated that correctly as the system seems to
      work OK most of the time.

      The error I get is;

      reference to invalid character number at line 1, column 5267, byte
      5267 at E:/Perl/site/lib/XML/Parser.pm line 187

      The XML returned begins like this;

      <?xml version="1.0" encoding="utf-8"?><soap:Envelope
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body>

      I am assuming - perhaps rashly - that this is because the XML
      document contains a character which isn't UTF-8?

      I note that in the area where the parser complains, I have a line
      that looks like this;

      <Title>Eternity Ring 12,990</Title>

      Firstly, is my diagnosis correct? I'm guessing that  isn't a
      valid UTF-8 character - or am I wrong here. I'm a bit out of my
      depth.

      Secondly (if my assumption is true) - whilst I can report this to
      the service provider and hope they clean their data, in the meantime
      is there a workaround for this that allows me to relax the rules
      that the soap::lite parser is enforcing. At present I just put an
      eval block around the method call to trap the error and stop
      additional processing of this item - but I'd really prefer to be
      able to process the data anyway.

      Any clues, links, advice much appreciated.

      Many Thanks
      Roger
      UK

      PS. My system is Win2003 server / Perl 5.8.3 build 809 / SOAP-LITE
      0.55
    • Show all 4 messages in this topic