Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 06-02-2005, 12:23 PM   #1
maglez
Registered User
 
Join Date: Jan 2004
Location: A Spanish in London
Posts: 195
Default Flash Number type and c# float and decimal types. Convertion problem within Flash.

Hello.

I've been searching on Google and on this forum for an answer without much success.

Introduction
I'm working with c# programmers, I'm doing the presentation layer, the graphics interface, they're doing the code behind.

We communicate Flash and c# through web services.

Data types in Flash are different than those in c#. Talking of numbers, the Flash Number type is big enough to hold any c# long, float, decimal, double or whatever else c# type.

The c# guys wrote a web service with different methods to be consumed for Flash. Each method on this web service return a given c# type for Flash to handle, methods like GetFloat, GetDouble, GetDecimal, GetLong, GetInt.

Once I get the value, which is not problem at all, I send it back using methods like ValidateFloat, ValidateDouble, ValidateDecimal, ValidateLong, ValidateInt.

And there is what the problem comes, very intrigue, I'll explain...

The problem
As I said, I haven’t any problem when getting the different values; they’re all converted to the Number type, which can hold really big numbers.

But when I send back those numbers to the web service to be validated, the long and decimal values fail, and it doesn’t fail outside of Flash, it fail before leaving Flash, since the error I get says…

…” Unable to connect to endpoint: http://pathToWebService/WebServiceName.asmx”…

My findings
And here is the curious part. Experimenting with different numbers, we found that if the number that is being sends to the web services is longer that 15 digits, then it fails. It seems to me that Flash is not able to wrap that number into the SOAP object and send it out to the web service to process it.

So that is the problem, Flash cannot send out numbers longer that 15 digits, not matter the value, it could be 1000000000000000 (16 digits) or 9999999999999999 (16 digits) that it fails.

Let me add that not matter what is on the server side, the web service is correct, the validate function is correct, the problem isn't on the server side, it is within Flash, we've been debugging on the server and Flash never get to the server side when dealing with those number larger than 15 digits.

What should I do if I want to send a number with more than 15 digits to a web service to process?

Any idea, comment or link will be much appreciated.

Thanks a lot for reading.
maglez is offline   Reply With Quote
Old 06-02-2005, 05:07 PM   #2
deadbeat
Registered User
 
Join Date: Feb 2001
Location: vancouver
Posts: 2,219
Default

Can you post the flash code you are using to connect to the web service?

K.
deadbeat is offline   Reply With Quote
Old 06-02-2005, 05:14 PM   #3
maglez
Registered User
 
Join Date: Jan 2004
Location: A Spanish in London
Posts: 195
Default Here it is

ActionScript Code:
//Log class--------------------------------------------- myLog = new Log(); myLog.onLog = function(text){     trace(text); } //Loading web service webService_ws = new WebService("http://pathToWebService/Service.asmx?wsdl");     GetLong_WSCBO = webService_ws.GetLong();     //Call back from method 1 if successful     GetLong_WSCBO.onResult = function(Result__GetLong_WSCBO:Number){         trace("Get Long Successful: " + Result__GetLong_WSCBO);                 //Executing method 2         return_GetLong_WSCBO = webService_ws.ValidateLong(Result__GetLong_WSCBO);                 //Call back from method 2 if successful         return_GetLong_WSCBO.onResult = function(result:Boolean){             trace("Send Long successful. Result: " + result);         }                 //Call back from method 2 if Not successful         return_GetLong_WSCBO.onFault = function(fault){             trace("Send Long Not Successful");             trace("ReturnSimpleMessage result: " + fault.faultcode);             trace("ReturnSimpleMessage result: " + fault.faultstring);             trace("ReturnSimpleMessage result: " + fault.detail);             trace("ReturnSimpleMessage result: " + fault.element);             trace("ReturnSimpleMessage result: " + fault.faultactor);         }     }         //Call back from method 1 if Not successful     GetLong_WSCBO.onFault = function(fault){         trace("Get Long Not Successful");         trace(fault.faultCode);     }
maglez is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:59 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.