Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

flash cs4 and web service

Posted on 2010-11-12
13
Medium Priority
?
373 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 2000 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
Suggested Courses

618 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