1 Reply Latest reply on Apr 14, 2009 2:44 AM by dersler

    Multiple calls using HTTPService

      I am beginner with Flex.

      My Flex application uses an HTTPService to communicate with a server running php.

      <mx:HTTPService result="WaitForAcqChangeComplete(event);"
      <mx:request xmlns="">

      I have written a php extension DLL that is called from the php code. One of the functions I provide essentially puts the calling thread to sleep until something server event happens. (This is in my DLL, where i use the Windows WaitForMultipleObjects() function).
      Waiting here could take a long time, or potentially never happen.

      If the even happens, the call into the extension completes, and the php page is provided back to the flex app, which
      then calls the completion code for the HTTPSerivce.

      This all works fine, until the flex application tries to make another access to waitforsomething.php while a previous
      access has still not completed. In this case, waitforsomething.php doesn't get called at all. Only when the previous call completes, does the next call come in.

      By playing around, i notice that if i add contentType="application/xml" to the HTTPService request, then it all works
      as expected, and i can have multiple calls to the server. Remove it, and I am back to only ever having one call at
      any time.

      I realise that adding contentType="application/xml" is not correct for what i am doing, but why does it make it work?
      What is the correct solution to this type of problem? Am I looking at some kind of cache issue?

      Any help will be very much appreciated.
        • 1. Re: Multiple calls using HTTPService
          dersler Level 1
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
          horizontal" horizontalAlign="left"
          srv.send()" viewSourceURL="srcview/index.html">

              <mx:NumberFormatter id="nf"/>
              <!-- resultFormat tells the HTTPService how to deserialize the result of the HTTP request.
                   By default, the response is deserialized into an object graph. This allows you to navigate through
                   the service result using the dot notation.
                   You can also get the result as an XML document by specifying resultFormat="e4x" on the HTTPService.
                   In that case, you can parse the document using E4X (ECMAScript for XML).
              <mx:HTTPService id="srv" url="items.xml" resultFormat="e4x"/>

              <mx:Tree id="tree" dataProvider="{srv.lastResult}" labelField="@name"
          300" height="100%"/>

                  <mx:FormItem label="Population:">
                      <!-- e4x data binding expression -->
                      <mx:TextInput text="{nf.format(tree.selectedItem.@population)}"/>
                  <mx:FormItem label="Capital:">
                      <!-- e4x data binding expression -->
                      <mx:TextInput text="{tree.selectedItem.@capital}"/>

                  FormItem {
                      labelStyleName: formItemLabel;
                  .formItemLabel {
                      color: #FFFFFF;