Uploaded image for project: 'Axis'
  1. Axis
  2. AXIS-2025

Illegal XML characters in String arguments and return values cause XML exceptions in Axis calls

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 1.2
    • None
    • None
    • All (but reproduced on WinXP).
      Axis 1.1 and 1.2

    Description

      Arguments and return values of Java type String are incorrectly handled if they contain non-printing illegal ASCII characters.

      Example 1: bad return values:

      • - - - - - - - - - - - - - -

      E.g. the string

      "bad char: " + (char)3 + "."

      Trivial example:

      foo.jws:
      public class foo {
      public String badmsg()

      { return "bad: " + (char)3 + "."; }

      }

      When calling this method and the server is running on Axis 1.1, it returns XML with the illegal character ASCII "3" in the text:

      <badmsgReturn xsi:type="xsd:string">bad: ?.</badmsgReturn>

      This causes an XML parse exception on the client side ("org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x3) was found in the element content of the document.")

      With Axis 1.2, the server doesn't even return a valid response: I get an HTTP 200 OK with an empty content, causing a different XML parse error.

      Example 2: bad parameter values:

      • - - - - - - - - - - - - - - -

      A similar problem exists when passing such a string from the the client side.

      If I have a method in foo.jws:

      public class foo {
      public String echo(String s)

      { return s; }

      }

      Then if I write an ordinary Java client to call this, and pass it a bad string as in the beginning of this post, I get an exception thrown while the call is being composed:

      java.lang.IllegalArgumentException: The char '0x3' in 'bad char: ?.' is not a valid XML character.

      This is somewhat absurd: shouldn't the serialization layer be encoding these illegal XML characters as entity escapes? They're entirely legal in the current locale (US), and normal Java code handles this character quite normally. Why should it croak when passed by XML/RPC?

      Attachments

        1. Axis1.1badmsgAPI.log
          2 kB
          Shankar Unni
        2. Axis1.1echoAPI.log
          2 kB
          Shankar Unni
        3. Axis1.2badmsgAPI.log
          2 kB
          Shankar Unni
        4. Axis1.2echoAPI.log
          0.5 kB
          Shankar Unni

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            venkat Venkat Reddy
            shankarunni Shankar Unni
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment