9 Replies Latest reply on Nov 20, 2008 1:12 PM by Developer504

    Passing data in paramaters

    Developer504 Level 1
      Ok I have this HTTPService, works fine. I have been passing hard-coded values "A" and "B", but now I want to pass a value in a variable. I don't understand the syntax though. I've tried a couple things with no luck. What is the syntax (and where might I have been able to find it I couldn't find anything like this on the help or web pages)

      <mx:HTTPService id="SetPilot"
      url=" http://localhost/magic94scripts/mgrqcgi94.exe"
      method="POST"
      useProxy="false">
      <mx:request>
      <appname>NOBRAWeb</appname>
      <prgname>SetPilot</prgname>
      <arguments>param1, param2</arguments>
      <param1>A</param1>
      <param1>B</param1>
      </mx:request>
      </mx:HTTPService>
        • 1. Re: Passing data in paramaters
          Level 7

          "Developer504" <webforumsuser@macromedia.com> wrote in message
          news:gg25bp$5tv$1@forums.macromedia.com...
          > Ok I have this HTTPService, works fine. I have been passing hard-coded
          > values
          > "A" and "B", but now I want to pass a value in a variable. I don't
          > understand
          > the syntax though. I've tried a couple things with no luck. What is the
          > syntax (and where might I have been able to find it I couldn't find
          > anything
          > like this on the help or web pages)
          >
          > <mx:HTTPService id="SetPilot"
          > url=" http://localhost/magic94scripts/mgrqcgi94.exe"
          > method="POST"
          > useProxy="false">
          > <mx:request>
          > <appname>NOBRAWeb</appname>
          > <prgname>SetPilot</prgname>
          > <arguments>param1, param2</arguments>
          > <param1>A</param1>
          > <param1>B</param1>
          > </mx:request>
          > </mx:HTTPService>
          >

          <mx:HTTPService id="SetPilot"
          url=" http://localhost/magic94scripts/mgrqcgi94.exe"
          method="POST"
          useProxy="false">
          <mx:request>
          <appname>NOBRAWeb</appname>
          <prgname>SetPilot</prgname>
          <arguments>param1, param2</arguments>
          <param1>{thing1}</param1>
          <param1>{thing2}</param1>
          </mx:request>
          </mx:HTTPService>

          Assuming thing1 and thing2 are bindable variables.


          • 2. Passing data in paramaters
            Developer504 Level 1
            Ok thanks Amy that was simple enough!

            I have another question now though. I have this executing, it runs on an on-click event. It is calling my external app, and writing data to it just fine. But then after it does that I get an error message 1090 "XML Parser element is malformed"

            The difference between this and my other WS calls, is that in this case I am only setting a value I don't want any data back from the external app. I am then going to call another Flex program SWF file to run a report so it opens in a new window.

            Why is it giving me an error? Does the external App have to pass a value back to Flex?
            • 3. Re: Passing data in paramaters
              Level 7

              "Developer504" <webforumsuser@macromedia.com> wrote in message
              news:gg453m$nav$1@forums.macromedia.com...
              > Ok thanks Amy that was simple enough!
              >
              > I have another question now though. I have this executing, it runs on an
              > on-click event. It is calling my external app, and writing data to it
              > just
              > fine. But then after it does that I get an error message 1090 "XML Parser
              > element is malformed"

              Possibly your back end page is sending back a response anyway.


              • 4. Re: Passing data in paramaters
                Developer504 Level 1
                [/quote]Possibly your back end page is sending back a response anyway.



                Perhaps. I changed it so it sent something back (even though I don't need anything back) and now it works without any errors so no big deal I guess.

                D.

                • 5. Passing data in paramaters
                  Developer504 Level 1
                  Ok now I have another problem... a really strange one.

                  Flex seems to be doing some things out of order or something, it's sending the wrong value.

                  I have this handler for my on-click event:

                  public function goUrlTFP(event:ChartItemEvent):void {
                  thing1=event.hitData.item.thing;
                  SetPilot.send();
                  rptWebsite="TurnData_PR.swf";
                  return navigateToURL(new URLRequest(rptWebsite))
                  }

                  Where "thing1" is a bindable variable used as the paramter being passed in my HTMLmerge per above.

                  So that when the user clicks on one of the bars on my barChart, this is supposed to do the following:

                  1) set the current value of the bar clicked on into the bindable variable 'thing1'. (which seems to work)
                  2) run the HTTPService call to write this value to my external App (which seems to work incorrectly)
                  3) navigate to the other SWF file which will interract with the external App based on this value. (which works)

                  The problem is, instead of sending the value for the particular record the client clicked on, it always sends the first record. But what is really strange is, to debug this, I put a label on the form to show the value of 'thing1', and it shows the correct value, (the value that they clicked on)

                  i.e for example, if they click on number six, my label shows number six, but the external app recieves number 1.

                  It seems like Flex is doing the call to the HTTPService before it has set the variable, even though it's supposed to happen after based on the code I wrote. Is this what is happening, and if so, what is the work-around for this?

                  D.
                  • 6. Re: Passing data in paramaters
                    Developer504 Level 1
                    Scratch that it was a problem with my external app, this is working perfect now.
                    • 7. Re: Passing data in paramaters
                      Level 7

                      "Developer504" <webforumsuser@macromedia.com> wrote in message
                      news:gg4f38$6de$1@forums.macromedia.com...
                      > Ok now I have another problem... a really strange one.
                      >
                      > Flex seems to be doing some things out of order or something, it's sending
                      > the
                      > wrong value.
                      >
                      > I have this handler for my on-click event:
                      >
                      > public function goUrlTFP(event:ChartItemEvent):void {
                      > /* rptWebsite=ceDs.@rptUrl */
                      > thing1=event.hitData.item.thing;
                      > SetPilot.send();
                      > rptWebsite="TurnData_PR.swf";
                      > return navigateToURL(new URLRequest(rptWebsite))
                      > }
                      >
                      > Where "thing1" is a bindable variable used as the paramter being passed in
                      > my
                      > HTMLmerge per above.
                      >
                      > So that when the user clicks on one of the bars on my barChart, this is
                      > supposed to do the following:
                      >
                      > 1) set the current value of the bar clicked on into 'thing1'
                      > 2) run the HTTPService call to write this value to my external App
                      > 3) navigate to the other SWF file which will interract with the external
                      > App
                      > based on this value.
                      >
                      > The problem is, instead of sending the value for the particular record the
                      > client clicked on, it always sends the first record. But what is really
                      > strange is, to debug this, I put a variable on the form to show what value
                      > was
                      > in 'thing1', and it shows the correct value, (the value that they clicked
                      > on)
                      >
                      > It seems like Flex is doing the call to the HTTPService before it
                      > has
                      > set the variable, even though it's supposed to happen after based on the
                      > code I
                      > wrote. Is this what is happening, and if so, what is the work-around for
                      > this?

                      What is the data type of thing1?


                      • 8. Re: Passing data in paramaters
                        Developer504 Level 1
                        It was a string, but this is fixed now don't worry about it.
                        • 9. Re: Passing data in paramaters
                          Developer504 Level 1
                          It was a string, but this is fixed now don't worry about it.