1 Reply Latest reply on Aug 23, 2013 5:09 AM by wolowizard

    Escaping special character < and > in EAP6

    wolowizard Newbie

      Hello, we have a legacy application running on an old JBoss Eap5. We would like to upgrade to Eap6, but have encountered a small "snag" that I hope you can help with.

       

      We have a method that returns an database generated XML as String in a SOAP message. Now, in the old Eap5 implementation, the XML looked like this:

       

      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

      <soap:Body><return>&lt;data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;

      &lt;name&gt;Peter&lt;/name&gt;&lt;/data&gt;</return>....

       

      Which is what you'd expect, as the XML-as-string is packed in a soap call, the special characters must be escaped. Fine.

       

      Now, in Eap6, the same call produces this:

       

      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

      <soap:Body><return>&lt;data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

      &lt;name>Peter&lt;/name>&lt;/data></return>....

       

      This is also legal XML as the ">" appears to be optional to escape. The problem is, this breaks a third party legacy system that I have no controll over.

       

      I have seen some stuff online about forcing JAXB to write this XML properly, but the problem is, that since we return a String, and not any type of object, the generated string will be picked up and escaped further down in the stack, and I will still be in trouble (for example the & will be escaped by &amp, and that will most certainly break the legacy stuff).

       

      Is there any way of telling the server (maybe by somehow injecting my own XML-writer) to properly escape both "<" and ">"? Alternatively: Can I disable the escaping all together and take responsibility for the escaping myself? Not really something i prefer, but this is some services that will never be changed and probably phased out in the near-distant future.

       

      Hope you can help, thanks.