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

4289Re: [soaplite] XML Fragment in String Data causes Soap Error ...

Expand Messages
  • Joseph Hourcle
    Jan 6, 2005
      On Thu, 6 Jan 2005, etaekema wrote:

      >
      >
      > Hello everyone. I have a fairly simple soap server that takes input
      > from a customer issue management system and transfers them to a
      > different issue management tool. The trouble I am having is that
      > some of the data is "free form" entry and is likely to have
      > incomplete / partial xml tags in the data. All the data passed to
      > the webservice are String types and when the soap::lite server
      > receives the data it is choking on the partial/embedded data in the
      > string .... I don't have a lot of control on the sending side ... Is
      > there an encoding trick to solve this?
      >
      > Something as simple as this fails ...
      > my $issue_description="The <tag> configuration doesn't work";
      > my $result = $service->submitIssue($issue_description);
      >
      > because the <tag> item isn't closed .... but since this is just user
      > entered text ... there isn't much I can do about it ...

      It's a problem with the SOAP client -- they're not escaping entities.

      use CGI ( escapeHTML );
      my $result = $service->submitIssue( escapeHTML($issue_description) );

      If the client was SOAP::Lite, it should've done it for you, unless you've
      overriden the serializer. [which I did once, and tried just marking
      strings as CDATA, but the SOAP::Lite deserializer choked hard on it]


      If you only have access to the server, you might want to make check
      _exactly_ what had been received, and verify if it's coming in unescaped.
      if it is, you need to fix the non-compliant client. If it isn't, or if
      it's marking the strings as DATA or CDATA, rather than encoding the
      entities, you'll need to modify the deserializer to support that.


      -----
      Joe Hourcle
    • Show all 6 messages in this topic