Solved

flash cs4 and web service

Posted on 2010-11-12
13
363 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now