You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Shankar Unni (JIRA)" <ax...@ws.apache.org> on 2005/06/01 00:11:04 UTC

[jira] Updated: (AXIS-2025) Illegal XML characters in String arguments and return values cause XML exceptions in Axis calls

     [ http://issues.apache.org/jira/browse/AXIS-2025?page=all ]

Shankar Unni updated AXIS-2025:
-------------------------------

    Attachment: Axis1.1badmsgAPI.log

Client-side log for "String badmsg()" API with Axis 1.1. No server-side error logged.

Tcpmon shows:

REQUEST:

POST /test/foo.jws HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1
Host: localhost
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 345

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


RESPONSE:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=74D27D49C88ED25507825C0CEEB7FA96; Path=/test
Content-Type: text/xml;charset=utf-8
Date: Tue, 31 May 2005 21:51:39 GMT
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
      <soapenv:Body>  
         <badmsgResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">   
            <badmsgReturn xsi:type="xsd:string">bad: .</badmsgReturn>  
         </badmsgResponse> 
      </soapenv:Body>
   </soapenv:Envelope>



> Illegal XML characters in String arguments and return values cause XML exceptions in Axis calls
> -----------------------------------------------------------------------------------------------
>
>          Key: AXIS-2025
>          URL: http://issues.apache.org/jira/browse/AXIS-2025
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2
>  Environment: All (but reproduced on WinXP).
> Axis 1.1 and 1.2
>     Reporter: Shankar Unni
>  Attachments: Axis1.1badmsgAPI.log, Axis1.1echoAPI.log, Axis1.2badmsgAPI.log, Axis1.2echoAPI.log
>
> 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?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira