A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: XML.sendAndLoad issue

  1. #1
    Junior Member
    Join Date
    Jan 2003
    Posts
    6

    XML.sendAndLoad issue

    I'm creating an XML object in Flash MX to send to a JSP page. The problem is that I'm at the threshhold where if I add any more XML elements, I receive an error on the JSP said stating that the XML object it is receiving is null.

    I'm creating the XML object by first creating the entire XML in a string and then passing that string as a parameter to the XML object. --> xmlRequest= new XML(string)

    Is there a size limitation in Flash that prevents an XML object from being sent if it crosses that threshhold. Or is their a
    limit to the size of a string.

    Any insight into this issue would be greatly appreciated.

    Thank You

  2. #2
    Senior Member
    Join Date
    Jun 2002
    Posts
    199
    there is a size limit on the amnount of chars any url call can handle, the number escapes me, but sadly it;s not very much.

    It's probably best to creative a recursive function which sends the data in packets.

  3. #3
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Usually it comes in at 1024 or 2048 characters. However I know there can be times on Windows machines where this is cut down to 256 characters (a clickable URL is the equivalent of pasting it into the run dialog box and limited to 256 chars).

    Use post to send the data through to the JSP (XML.send), although unforutnately this doesn't work in the standalone or development environments, only in the browser.

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  4. #4
    Junior Member
    Join Date
    Jan 2003
    Posts
    6
    Thank you for both of your input. The flash program currently builds an XML string. I then feed it to the XML constructor and use the XML.sendAndLoad method.

    Here is a sampling of my XML file:
    <?xml version=\"1.0\" ?>
    <basket>\r";
    <type></type>
    <name>"+_root.cuserid+"</name>\r";
    myXMLStr = myXMLStr+"\t<description>"+"ColorMyRug Custom Fabric Inlay"+"</description>\r";
    myXMLStr = myXMLStr+"\t<price>"+vPrice+"</price>\r";
    myXMLStr = myXMLStr+"\t<qty>"+"1"+"</qty>\r";
    myXMLStr = myXMLStr+"\t<options>"+"8"+"</options>\r";
    myXMLStr = myXMLStr+"\t<optionlist>\r";
    myXMLStr = myXMLStr+"\t\t<option1>";
    myXMLStr = myXMLStr+"\t\t\t<opt_desc1>"+"Carpet - Outside Border"+"</opt_desc1>\r";
    myXMLStr = myXMLStr+"\t\t\t<opt_type1>"+"nocharge"+"</opt_type1>\r";
    myXMLStr = myXMLStr+"\t\t\t<opt_value1>"+vCarpetOutsideBorder +"</opt_value1>\r";
    myXMLStr = myXMLStr+"\t\t\t<opt_qty1>"+"1"+"</opt_qty1>\r";
    myXMLStr = myXMLStr+"\t\t</option1>\r";

  5. #5
    Junior Member
    Join Date
    Jan 2003
    Posts
    6

    PLEASE IGNORE

    please ignore my previous reply. I posted it before I completed my reply.

    Sorry

  6. #6
    Junior Member
    Join Date
    Jan 2003
    Posts
    6
    In Flash, I'm building an XML document with 83 XML elements and 66 Text nodes. However this XML object is sent to the JSP page as null. The XML document is basically a comprehensive product description document which as part of the document contains a list of 15 options that the product may have. After reducing the number of options to 9, I ended up with 53 XML elements and 42 Text nodes and everything was okay.

    I did use the method XML.ignoreWhite which allowed me to add another option successfully. I also used the XML.sendAndLoad to send the XML to my JSP page. The JSP page in return sends back an XML document indicating success or failure. However, I am still unable to send my entire XML document that I have built in Flash. I've scoured through the Flash documentation, but I was not able to find anything that mentioned a size restriction of the XML object.

    I have one idea that I would like to toss out. Is their a difference in how the XML object is constructed in Flash? Currently, I build a very long XML string and pass it as a parameter when I instantiate my XML object (xmlRequest = new XML(string)). I then changed this to use the XML.parseXML method(XML.parseXML(string)). They both had the same results. However, I did not try building the XML object using the XML methods such as XML.appendChild, XML.createElement, etc.

    Please let me know your thoughts on this issue.

    Thanks in advance.

  7. #7
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    I did use the method XML.ignoreWhite which allowed me to add another option successfully. I also used the XML.sendAndLoad to send the XML to my JSP page. The JSP page in return sends back an XML document indicating success or failure. However, I am still unable to send my entire XML document that I have built in Flash. I've scoured through the Flash documentation, but I was not able to find anything that mentioned a size restriction of the XML object.
    The problem isn't with XML in flash per se, but with the flash player and the development environment not being able to send the data as a post request to the web server. When you do it in the player it is sent as a get request with the XML in the URL, you are either hitting the limits of either your OS or your Web Server (as I said most restrict URLs to 1024 or 2048, some much shorter).

    It doesn't really matter how you build your XML, you'll end up with same XML objects.
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

  8. #8
    Junior Member
    Join Date
    Jan 2003
    Posts
    6
    I got you now. Since FLASH sends it as an HTTP GET method, it has the corresponding URL restrictions associated with it hence the 1024 or 2048 limitation. I was thinking that it uses a POST method.

    Thank you for clearing this up, it makes alot more sense now.

    Thanks again!

  9. #9
    Junior Member
    Join Date
    Jul 2002
    Posts
    6
    Hi:
    I would like to know which command do you use in JSP to read the XML sent by Flash

    I know in PHP is:

    $HTTP_RAW_POST_DATA

    But in JSP how is it?

  10. #10
    Senior Member
    Join Date
    Feb 2001
    Location
    Provo, Utah
    Posts
    1,112
    GET limits can be as low as 255 characters
    Richard Lyman
    rich at lithinos.com
    www.lithinos.com

  11. #11
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    Most are around 1024, but I think older versions of IIS limited to 255, and some smaller web servers limit themselves to a 255 character string.

    I also know that a url in Windows that is used outside a browser (eg mail client etc) passing the web request onto the command line which limits the request to 255 characters.

    It all gets confusing but in the end if you have anything more than simple data you should use post instead of get. Unfortunately there is not much we can do about flash in the dev/standalone environment.

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center