Solved

flash cs4 and web service

Posted on 2010-11-12
13
371 Views
Last Modified: 2013-11-11
hi

I'm a novice coder, and am trying to get flash to connect
to a webservice. I think I've got the connection :-) but
am unable to view the info, and after viewing various
tutorials and forums and completely stuck.

I have attached the fla which I hope will help.

And below the actionscript alone.


Thanks
0
Comment
Question by:sybrand01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
13 Comments
 

Author Comment

by:sybrand01
ID: 34128567
hi

just to confirm, I am trying to show "UKJackpotEstimate"
from the webservice "http://www.virtualworlddirect.com/elotterywebservice/lotteryservices.asmx?wsdl"
in flash, fla and code above.

Thanks

0
 
LVL 39

Expert Comment

by:blue-genie
ID: 34131769
hi your flash file is not attached.
are you using AS3 or AS2? are you using any existing component or classes?
0
 
LVL 2

Expert Comment

by:jockejocke
ID: 34133114
I havent done anything where Flash connects straigh to a SOAP service but I figure if it gets too tricky you could write a server side proxy script to handle the SOAP communication and then use a more AS3-supported data format between your server and Flash. Most server side languages have native (or add-on) support for SOAP, and it should be a pretty straightforward process to send and recieve envelopes. As a bonus, you may also control (server-side) who is authorized to use the data, if ever needed.

You probably already read it, but a quick googling resulted in this:
http://vevmedia.net/blog/actionscript-3-and-soap-webservices/

It looks like AS3 and SOAP works quite well, even though it seems (only scanned through results briefly) it is more of a workaround than a real solution since AS3 XML doesnt really like namespaces.

Good luck!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Expert Comment

by:blue-genie
ID: 34133753
xml in AS3 uses the ECMAScript Specs - hence  E4X so you can handle namespaces.

I use SOAP services on a daily basis with flash, but in order to point the asker to the right direction, need to know what he's currently doing.
 
0
 

Author Comment

by:sybrand01
ID: 34134825
hi  experts :-)

sorry the actionscript and fla seem to have gone?
Here they are again.
 
UKJackpot.fla  
import mx.services.WebService;
import mx.services.PendingCall;
function WebServiceCall(input:String) {

var outputField:TextField
var returnedValue:String;
var wsURL:String = "http://www.virtualworlddirect.com/elotterywebservice/lotteryservices.asmx?wsdl";
var ws:WebService = new WebService(wsURL);
var re:PendingCall = ws.LotteryGetAllDetails(UKJackpotEstimate);
re.onResult = function(result):Void {

returnedValue = result;
outputField.text = result;
trace("Jackpot is "+returnedValue);
callback = ws.LotteryGetAllDetails(UKJackpotEstimate);
callback.onResult = function(result){
      trace("result obtained");
      trace("result: " + result);
      TextField_txt.text = result;
}

};
re.onFault = function(fault) {

returnedValue = fault.faultCode+","+fault.faultstring;
{
   trace("fault.faultcode= " + fault.faultcode);
   trace("fault.faultstring= " + fault.faultstring);
   trace("fault.detail= " + fault.detail);
   trace("fault.element= " + fault.element);
   trace("fault.faultactor= " + fault.faultactor);
   trace( "-------------------" );
   trace( response );
}
trace(returnedValue);

};

}
// show UKJackpotEstimate”
WebServiceCall(UKJackpotEstimate);

Open in new window

0
 
LVL 39

Expert Comment

by:blue-genie
ID: 34135736
hello. where is UKJackpotEstimate declared?
I swapped out to one of my webservices and it works fine so i'm thinking

1. UKJackpotEstimate value ... check that - tried hard code an expected value - see what happens.
0
 

Author Comment

by:sybrand01
ID: 34136546
thanks blue-genie, I'm glad to know it connects. :-)
I don't understand what/ you mean 'where is UKJackpotEstimate declared'
or where to hard code an expected value?
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 34142710
you have this

ws.LotteryGetAllDetails(UKJackpotEstimate);

and  

WebServiceCall(UKJackpotEstimate);

what is UKJackpotEstimate??? I don't see it in your code snippet.
0
 

Author Comment

by:sybrand01
ID: 34143659
That is in the http://www.virtualworlddirect.com/elotterywebservice/lotteryservices.asmx?wsdl file.
LotteryGetAllDetails is the section and UKJackpotEstimate the figure I'm trying to view.?
0
 
LVL 39

Expert Comment

by:blue-genie
ID: 34143751
as far as I know, that's not how it works. unless there's a short cut no one told me about.

you call the function you want

in this case LotteryGetAllDetails .. i can't access it remotely to check if that expects any parameters.

you then get the data back, depending on how the webservice was done. we usually use xml, then in flash i take the xml and parse it to get the value i want.
0
 

Author Comment

by:sybrand01
ID: 34143837
I don't have access to change the webservice.
Is there a different way I can show the UKJackpotEstimate
from http://www.virtualworlddirect.com/elotterywebservice/lotteryservices.asmx?wsdl 
you mentioned as3 ECMAScript earlier, is this a different way?
or will I need to contact the developers and get them to
change the service to xml?
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 34145543
if you have access to the developers, just find out what if any parameters are expected.
try calling the  method without any parameters.. if you connect successfully just trace the result to see what format it is in.
0
 

Author Comment

by:sybrand01
ID: 34155260
Thats it sorted, extra parameters, runs perfect now :-)
thanks blue genie
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to how to record live broadcast.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question