FORUMS: list search recent posts

Flex webservice in action script 3.0 flash

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Neha Gandhi
Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 7:59:46 pm

Hi guys,

I migrated from actionscript 2.0 to 3.0, and i found out that 3.0 does not support Webservice. SO i used Flex web services, put "Framework.swc" and "rpc.swc" in the actionscript library.

I used loadWSDL() method and the result that is returned from web service is [object object]. I am unable to do anything with it and i am stuck miserably.

Please help..

Thanks,
Neha


Return to posts index

Pieter Helsen
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 8:25:33 pm

Hello Neha,

Try downloading Charles (http://www.charlesproxy.com/) and running it. It will allow you to investigate the return from your webservice.

Or.... use this to trace all values inside of the Webservice's return object:

var myObj:Object = {x:20, y:30};
for (var i:String in myObj)
{
trace(i + ": " + myObj[i]);
}


Kind regards,
Pieter

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.


Return to posts index

Neha Gandhi
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 8:36:43 pm

Hi Pieter,

I tried doing that but it returns me this below:
Devices: undefined
Status: undefined

Please see the code below that i have used to set up webservice.

var foo:WebService = new WebService();
foo.wsdl = "http://192.168.11.19/amddevices/request.asmx?WSDL";
foo.loadWSDL();
foo.addEventListener(LoadEvent.LOAD, finishedLoading);

function finishedLoading(evt:LoadEvent)
{
trace("finishedLoading method...");
var myOperation:Operation;
myOperation = Operation(foo.getOperation("GetDeviceInfo"));
myOperation.addEventListener("fault", wsFault);
myOperation.addEventListener("result", wsResult);
myOperation.send();
}

function wsResult(evt:ResultEvent)
{
var myResult:Object = evt.result;
for (var i:String in myResult)
{
trace(i + ": " + myObj[i]);
}
}

The GetDeviceInfo xml looks like this:

&
-
-
200
Successful

-
-
Welch Allyn
Oximeter
101


-
Welch Allyn
BloodPressureMonitor
101


-
Welch Allyn
Thermometer
101


-
GPC
GPC
102

-
-
-
-
type
GPC

-
format
h264

+
url
rtmp://192.168.11.19/live

-
stream
gpc





-
Stethoscope
Stethoscope
101





I am miserable right now. Could you give me some way out on this please. You have been really helpful.

Thanks,
Neha


Return to posts index


Neha Gandhi
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 8:46:06 pm

Sorry about the pasted xml of GetDeviceInfo. It does not get copied properly. But the first tag is Status and then its Devices.

Both are undefined if i try and use your code.

Thanks,
Neha


Return to posts index

Neha Gandhi
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 8:48:54 pm

Apology for the result..It comes as below if use your code:

Status: [object Object]
Devices: [object Object],[object Object],[object Object]


Return to posts index

Pieter Helsen
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 9:11:51 pm

Hello Neha,

Unfortunately I can't help you :( For some reason (I'm guessing it's firewall or network related) I can't access your webservice and so I cannot test your script on my computer.

However... since you are getting back objects, your webservice does seem to work. You should be able to check the response in charles, and that should give you a clue as to what those objects are. (they should be structured like the XML)

So you can call the information from the webservice result by doing something like this:
for each(var device:Object in result.Devices){
trace(device.name); // if name is the node name in your getDevices.xml
}

Kind regards,
Pieter

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.


Return to posts index


Neha Gandhi
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 9:55:24 pm

That's fine Pieter. But i got your point. I mean the problem is that i am getting Status and devices but not their childs. For that another for loop will be required and then another for loop for their sub childs.

One more thing, when you run in Device central, i can see the whole xml coming up enveloped in soap headers.

Thanks,
Neha


Return to posts index

Pieter Helsen
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 10:03:03 pm

What exactly do you want to do with the data?

Kind regards,
Pieter

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.


Return to posts index

Neha Gandhi
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 10:10:25 pm

I want to parse the data and get the child's info, as i have to use that info to get displayed in GUI. Like this is the sample below:


200
Successful



Welch Allynn
Oximeter
101
0001-01-01T12:00:00



So in this xml, i want to parse it and get the Oximeter from Oximeter so that i can display it in my GUI.

I hope i made it clear. Let me know.

Thanks,
Neha


Return to posts index


Neha Gandhi
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 10:15:43 pm

I have replaced the sample xml data with below as angle brackets just screw it up.

"?xml version="1.0" encoding="utf-8" ?>
Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"
Status
"StatusCode" 200 "StatusCode"
"StatusMessage" Successful "StatusMessage"
"Status"
"Devices"
"Device"
"Description" Welch Allyn "Description"
"Type" Oximeter "Type"
"Status" 101 "Status"
"Time" 0001-01-01T12:00:00 "Time"
"Device"
"Devices"
"Response"


Return to posts index

Neha Gandhi
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 10:24:07 pm

Hi Pieter,

I know its more to ask but can we share email id's like skype/gtalk so that we can communicate properly. I mean that's fine if you don't want to. But it would be great if i can solve this problem.

Thanks,
Neha


Return to posts index

Pieter Helsen
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 10:26:15 pm

If you send me your gtalk address at pieter_helsen [at] hotmail [dot] com I will add you :)

Kind regards,
Pieter

General notice: from now on, I would like to ask everyone to put [AS2] or [AS3] (corresponding to the version of actionscript you are using on your project) in front of their post titles when the question is actionscript related! Please help us help you faster. Thank you.


Return to posts index


Neha Gandhi
Re: Flex webservice in action script 3.0 flash
on Aug 21, 2010 at 10:31:47 pm

I have sent you an test email. I hope you got it.

Neha


Return to posts index

sumit Dev
Re: Flex webservice in action script 3.0 flash
on Jan 13, 2012 at 12:47:30 pm

hi Neha,

we can call web service in ActionScript 3.0. You just follow the website of actonscriptbible.com or read the book Action Script Bible 3.0. In book u will get all sample code.

Resgards
Sumit


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]