You're right, I took a closer look into the generated stub code and in the 
subclass of AbstractWebService - they've by-passed the usual RPC 
service/operation behavior and implemented a custom private call() method (and 
it's in there a new SOAPEncoder is constructed). This service stub really 
should expose a delegate to the SOAPEncoder. So. I think it's still worth 
logging a request in Flex Builder for this generated code to be updated in 
general, but I agree that really SDK-19811 needs to be fixed.

(Note: It seems SDK-19598 has become SDK-19811).

Pete


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of Francis Potter
Sent: Monday, March 23, 2009 7:10 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: AIR has different behaviour in XML.appendChild() vs 
Flex for String values?


Pete,

Thanks for the tip. I can set xmlSpecialCharsFilter on the service, but it 
doesn't get passed into the encoder.

Looking around at the generated code and that in the 3.2 SDK (maybe it's 
changed for 3.3?) I see that the FlexBuilder-generated code is using a class 
called WSDLOperation, and doesn't seem to be using Operation at all -- and it's 
in Operation (as you noted) that the xmlSpecialCharsFilter is passed down. Am I 
missing something?

Francis



--- In flexcoders@yahoogroups.com, Peter Farland <pfarl...@...> wrote:
>
> https://bugs.adobe.com/jira/browse/SDK-19598
> 
> Not a perfect solution, but to help out with your issue of modifying 
> generated code - your generated Service stub should have a method called 
> getWebService() which retuns a subclass of mx.rpc.soap.AbstractWebService. 
> You should be able to set the xmlSpecialCharsFilter property on this web 
> service instance, and that'll trickle down to any Operation's and then to any 
> SOAPEncoders used by these Operations.
> 
> Pete
> 
> 
> -----Original Message-----
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
> Behalf Of Francis Potter
> Sent: Monday, March 23, 2009 5:20 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: AIR has different behaviour in XML.appendChild() vs 
> Flex for String values?
> 
> 
> I'm glad you wrote this up because I thought I was going crazy.
> 
> In my case, I'm using the FlexBuilder-generated web services client code in 
> AIR. The SOAPEncoder and XMLEncoder classes actually end up double-escaping 
> any XML characters in strings that are being passed up to my web service so a 
> simple "<" character becomes "&amp;lt;", which is decoded on the other end as 
> "&lt;" instead of as "<".
> 
> I can see where it's happening. XMLEncoder.as, line 1784, looks like this:
>                     
> currentChild.appendChild(xmlSpecialCharsFilter(Object(value)));
> 
> The "xmlSpecialCharsFilter" is doing the escaping, then appendChild (as your 
> note points out) escapes the string again.
> 
> Of course, since the problem is too much escaping, pre-escaping the string 
> won't help.
> 
> The only way around it in XMLEncoder is to replace the 
> xmllSpecialCharsFilter. But in my case, I'm using the FlexBuilder-generated 
> web services code (from Data -> Import Web Services). So for now I'm editing 
> that code. Of course that means I have to re-edit the code each time my 
> service changes and I regenerate it. What a pain.
> 
> Here's what I did, in Base<servicename>.call:
> 
> var enc:SOAPEncoder = new SOAPEncoder();
> enc.xmlSpecialCharsFilter = function(value:Object):String {return 
> value.toString()}
> var soap:Object = new Object;
> 
> That works, but only in AIR (I assume, not really trying it in Flex).
> 
> So there's a hacky workaround. But really this should be fixed. At the very 
> least, the FlexBuilder-generated code should be set up to work in either 
> environment. As it is, "Import Web Services" will err for an AIR app where 
> there is a "<" or "&" in any text property passed to the web service.
> 
> Is there a bug for this?
> 
> 
> 
> 
> ------------------------------------
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location: 
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives: 
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
>




------------------------------------

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: 
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 
Groups Links



Reply via email to