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

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

Expand Messages
  • Joseph Hourcle
    ... It s a problem with the SOAP client -- they re not escaping entities. use CGI ( escapeHTML ); my $result = $service- submitIssue(
    Message 1 of 6 , Jan 6, 2005
    • 0 Attachment
      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
    • etaekema
      Thankd Joe. The client is something written in .NET ... I ve asked them to try to encode the freeform string parameters ... hopefully they can do that. I
      Message 2 of 6 , Jan 6, 2005
      • 0 Attachment
        Thankd Joe. The client is something written in .NET ... I've asked
        them to try to encode the freeform string parameters ... hopefully
        they can do that. I thought that soap::lite did the encoding too,
        but it appears in my case that it doesn't. I am accessing the
        service through a wsdl .. is it possible that the wsdl is somehow
        specifying something different?

        Cheers,

        Ed

        >
        > 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
      • Joseph Hourcle
        ... The serializer in SOAP::Lite will encode entities (using SOAP::Utils::encode_data) if it s attempting to serialize it as a string. I haven t played with
        Message 3 of 6 , Jan 6, 2005
        • 0 Attachment
          On Thu, 6 Jan 2005, etaekema wrote:

          > Thankd Joe. The client is something written in .NET ... I've asked
          > them to try to encode the freeform string parameters ... hopefully
          > they can do that. I thought that soap::lite did the encoding too,
          > but it appears in my case that it doesn't. I am accessing the
          > service through a wsdl .. is it possible that the wsdl is somehow
          > specifying something different?

          The serializer in SOAP::Lite will encode entities (using
          SOAP::Utils::encode_data) if it's attempting to serialize it as a string.

          I haven't played with the WSDL support in SOAP::Lite, or used SOAP::WSDL,
          so I don't know what might've caused the problem -- I've just seen the
          same error message before, so I knew what the likely culprit was.

          [Although, in my case, I was the one that caused it, because of replacing
          the serializer, and things weren't calling the default encoding functions]

          -----
          Joe Hourcle
        • etaekema
          I just ran a quick test and if I connect directly to the soap service it encodes the
          Message 4 of 6 , Jan 6, 2005
          • 0 Attachment
            I just ran a quick test and if I connect directly to the soap service
            it encodes the < characters and decodes it on the other side ... if I
            do it through the WSDL ... it doesn't encode it ... Is there
            something I can do in the wsdl file to force it do encode/decode
            correctly?

            Ed

            --- In soaplite@yahoogroups.com, Joseph Hourcle <oneiros@g...> wrote:

            >
            > I haven't played with the WSDL support in SOAP::Lite, or used
            SOAP::WSDL,
            > so I don't know what might've caused the problem -- I've just seen
            the
            > same error message before, so I knew what the likely culprit was.
            >
            > [Although, in my case, I was the one that caused it, because of
            replacing
            > the serializer, and things weren't calling the default encoding
            functions]
            >
            > -----
            > Joe Hourcle
          • etaekema
            Just ran a second test ... this time connecting to the same soap::lite service through the wsdl .. only this time using SOAPpy .. no problems at all there ...
            Message 5 of 6 , Jan 6, 2005
            • 0 Attachment
              Just ran a second test ... this time connecting to the same
              soap::lite service through the wsdl .. only this time using SOAPpy ..
              no problems at all there ... must have something to do with
              soap::lite's wsdl support.

              Cheers,

              Ed
              --- In soaplite@yahoogroups.com, "etaekema" <etaekema@e...> wrote:
              >
              > I just ran a quick test and if I connect directly to the soap
              service
              > it encodes the < characters and decodes it on the other side ... if
              I
              > do it through the WSDL ... it doesn't encode it ... Is there
              > something I can do in the wsdl file to force it do encode/decode
              > correctly?
              >
              > Ed
              >
              > --- In soaplite@yahoogroups.com, Joseph Hourcle <oneiros@g...>
              wrote:
              >
              > >
              > > I haven't played with the WSDL support in SOAP::Lite, or used
              > SOAP::WSDL,
              > > so I don't know what might've caused the problem -- I've just
              seen
              > the
              > > same error message before, so I knew what the likely culprit was.
              > >
              > > [Although, in my case, I was the one that caused it, because of
              > replacing
              > > the serializer, and things weren't calling the default encoding
              > functions]
              > >
              > > -----
              > > Joe Hourcle
            Your message has been successfully submitted and would be delivered to recipients shortly.