7 Replies Latest reply on Nov 14, 2008 12:14 AM by atta707

    Http Service Round Up problem

    kitumaster
      Hi,
      I am using flex3 in the client side and java 5 in the server side in a web application.
      In my application to exchange the data I am using HttpService mechanism.

      Now in this mechanism I am facing the following problem.

      A field is alphanumeric in nature. Now when it contains purely numeric value more than 14 digits, then when accessing it in the success result handler it is giving the round up value though I need the original value.

      For example:

      Let say it is BIC Code and its original value is 5251010000000327842.

      When I am generating the response from the server side I am setting this value.
      Now when I access this from the success result handler I get the value as 5251010000000328000 instead of 5251010000000327842.


      Can any one help me how to over come the problem?
      Thanks in advance.
        • 1. Re: Http Service Round Up problem
          atta707 Level 2
          I'm assuming you store this code in Java as a you said it a alphanumeric and that you just write it as a string to the HTTPServletResponse somewhere on the server side.

          Can you show some code how do you read this code value in the result event of HTTPService instance?

          ATTA
          • 2. Re: Http Service Round Up problem
            kitumaster Level 1
            Yes, I have store it in String property in the POJO at server side.
            After completing the server side processing, I am generating xml as responcs based on the value of POJO. Now at the client side httpService result handler I am accesing the value. When I am accessing the value inside result event handler I am getting it different as metion aboved.

            code:

            <mx:HTTPService id="loaddata" fault="Alert('Error Occured : ' + event.fault.faultDetail)" url="xyz/abcDispatchAction.action?method=loadBICCode"
            result="populateBICCode(event)" showBusyCursor="true" />

            private function populateBICCode(event:ResultEvent):void{
            mytext.text = event.result.myForm.entObj.BICCode
            }
            • 3. Re: Http Service Round Up problem
              atta707 Level 2
              see if casting the expression to a String helps:

              mytext.text = String(event.result.myForm.entObj.BICCode);

              or

              mytext.text = event.result.myForm.entObj.BICCode as String;
              • 4. Re: Http Service Round Up problem
                Level 7

                "kitumaster" <webforumsuser@macromedia.com> wrote in message
                news:gfgsdh$de8$1@forums.macromedia.com...
                > Hi,
                > I am using flex3 in the client side and java 5 in the server side in a web
                > application.
                > In my application to exchange the data I am using HttpService mechanism.
                >
                > Now in this mechanism I am facing the following problem.
                >
                > A field is alphanumeric in nature. Now when it contains purely numeric
                > value
                > more than 14 digits, then when accessing it in the success result handler
                > it is
                > giving the round up value though I need the original value.
                >
                > For example:
                >
                > Let say it is BIC Code and its original value is 5251010000000327842.
                >
                > When I am generating the response from the server side I am setting this
                > value.
                > Now when I access this from the success result handler I get the value as
                > 5251010000000328000 instead of 5251010000000327842.


                http://choronzon.net/Jared/OReilly%20Bookshelves/web2/action/ch04_03.htm


                • 5. Re: Http Service Round Up problem
                  kitumaster Level 1
                  I have type cast it to String but that is not working.
                  • 6. Re: Http Service Round Up problem
                    kitumaster Level 1
                    Please note that BIC Code value can be 52510100APC00327842 or some other alphanumeric charecter.
                    • 7. Re: Http Service Round Up problem
                      atta707 Level 2
                      as the link Amy referred to above says:

                      "Flash uses double-precision floating-point numbers, which offer precision to about 15 significant digits. (Any leading zeros, trailing zeros, and/or exponents are not counted as part of the 15 digits.) This means that Flash can represent the number 123456789012345, but not 1234567890123456. The precision doesn't limit how big a number can get, only how precise a number can be represented; 2e16 is a bigger number than 123456789012345 but employs only one significant digit."

                      makes it clear what's going on.

                      I've a feeling that type of myForm.entObj.BICCode field is Object! Is it? How are you getting data back? As XML? If not, can you show the code for entObj object?

                      If entObj.BICCode was indeed of type Object, for an ugly workaround I'll prepend an _ to the value to force it into a string and then remove the _ character from that string!

                      private function populateBICCode(event:ResultEvent):void{
                      var o:Object = "_" + event.result.myForm.entObj.BICCode;
                      mytext.text = o.toString.substring(1);
                      }