3 Replies Latest reply on Dec 7, 2010 1:18 AM by SJ_FR

    Passing XML in parameter to WebService

    SJ_FR

      Hi everyone,

       

      I know that this stuff has already been discussed before but the workaround with xmlSpecialCharsFilter doesn't work for me.

       

      Here is my case:

       

      I'm working with Flex Builder 3, SDK 3.2. I have an AIR project which is supposed to call some webservice and to pass XML using the parameters to the webservice.

      The strange thing is that the XML is correct in my code, but when received by the server the XML is altered and not parsable anymore.

      At the start, i have something like <XMLTAG> and when the server receives it, it looks like &amp;lt;XMLTAG&gt; but my server is expecting the first syntax.

       

      The trick to set the webservice object's xmlSpecialCharsFilter to the function returning the toString() value of the parameter object doesn't work: instead of getting &amp;lt;XMLTAG&rg; i get &lt;XMLTAG&gt;... That's cool but it doesn't help me at all.

       

      Did i have misunderstood something in the workaround or is the only solution is to change my server (something like passing base64 encoded XML and decoding it on the server).

       

      I'm kind of new with this kind of problem so excuse me if this is a newbie question.

       

      Thank you for your help.

       

      Best regards,

      SJ.

        • 1. Re: Passing XML in parameter to WebService
          Claudiu Ursica Level 4

          I might just be beating around the bush so in that case just ignore the reply.

           

          see this top level function maybe they help in a way:

           

          http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/package.html?filter_fle x=4.1&filter_flashplayer=10.1&filter_air=2

           

           

           

           

           

          decodeURI(uri:String):String

          Decodes an encoded URI into a string. Top Level

              decodeURIComponent(uri:String):String

          Decodes an encoded URI component into a string. Top Level

              encodeURI(uri:String):String

          Encodes a string into a valid URI (Uniform Resource Identifier). Top Level

              encodeURIComponent(uri:String):String

          Encodes a string into a valid URI component. Top Level

              escape(str:String):String

          Converts the parameter to a string and encodes it in a URL-encoded format,       

          where most nonalphanumeric characters are replaced with % hexadecimal sequences.

           

           

           

           

          Whenever I worked with webservice I did it with generated wit objects not XML so

          not sure those apply. However I had issues with escaping with URL loader and old

          cgi scripts so those functions were helpfull.

           

          If they do not apply to your case ignore this as I said,

          Cheers,

          Claudiu

          • 2. Re: Passing XML in parameter to WebService
            SJ_FR Level 1

            Unfortunately Claudiu, this doesn't help me My problem is more webservice-related, i really would like to send some xml, and i'm expecting this is possible because let's imagine you want to create a client, you aren't always able to adapt the server to your client. In my case i could be able to do it, but that would be the ugliest solution.

             

            I tested the xmlSpecialCharsFilter thing but could there be some kind of special command to really escape the < and > characters??

             

            I would really appreciate some help on this problem...


            Thank you very much.

            Best regards,

             

            SJ.

            • 3. Re: Passing XML in parameter to WebService
              SJ_FR Level 1

              Solved,

               

              But i'm not sure to understand why. Finally, this morning i retried the xmlSpecialCharacterFilter thing and it works.

              Is there some kind of cache in the AIR runtime that could have been cleared by restarting my computer?

              Or just i didn't set the xmlSpecialCharacterFilter function with the right timing. For those who could encountered the problem, i set it on my webservice object right before the loadWSDL command.

               

              Regards,

               

              SJ.