3 Replies Latest reply on Oct 23, 2009 10:15 AM by Brent Lamborn

    Flex XML encoding issue

    Brent Lamborn

      I have a web service. Importing the WSDL into Flex Builder 3, Flex Builder generates proxy ActionScript classes to interact with my web service. Some of my web service methods accept strings as parameters. The strings contain xml.


      I see that when Flex sends the SOAP request to my webservice it does some xml encoding of the body of the message. Here is the problem I see. All of my left angle brackets are getting encoded incorrectly by Flex. For example:




      should get encoded as:




      but instead it is double-encoding the left angle brackets so I get:




      The encoder is actually encoding the ampersand in &lt; again, after it has already been encoded to xml from <.


      Has anyone else ran into this? I've been working with this app for a year and have never seen this happen. I haven't upgraded my version of Flex or anything. The problem seems to have just started happening out of the blue - which I know doesn't seem possible but nothing in my development environment has changed that should cause this. Any ideas?

        • 1. Re: Flex XML encoding issue

          I'm also running into this problem.  I'm running on Eclipse 3.4 w/ the WBEJ_plugin 3.2.


          Everyon else using this application isn't have a problem saving and the encoder doesn't mess up their SOAP requests, but each time I send, SOAP double-encodes the &, resulting in the error you described.  The problem I was running into was then dealing w/ that XML on a return SOAP, where I'm expecting well formed XML, and instead I get &amplt;WhateverName&gt;, which Flex reinterprets as &lt;, and not <.  I made an ugly hack for that that will just split/join any of those, but if there is a real reason why this is happening, that would be great to find out.

          • 2. Re: Flex XML encoding issue
            lordB8r Level 1

            I'm having the exact same problem.  I made an ugly hack for any of my xml to just split/join on the &lt;, but this only happened after I let Eclipse dl and install updates...i think that's my mistake, and maybe i'll retrograde, but until then, it's very annoying.

            • 3. Re: Flex XML encoding issue
              Brent Lamborn Level 2

              Good to know someone else has the same issue. To work around it, I base64 encode all my params that are XML before call send on the soap request, then Base64 decode in my web service. Base64 encoding it prevents Flex from messing with the XML just before the send. Shouldn't have to do it, but it works and now I don't have to worry about Flex soap doing anything funny with the encoding. This issue seems to arise out of nowhere for me, so I don't want to take any chances.