Solved

Calling a webservice from flash 8-  works in preview mode but not on live site

Posted on 2006-06-24
3
671 Views
Last Modified: 2008-08-14
Hi,

i am experienced in working with webservices and calling them from various languages.  however, im not very experienced with flash and im trying for the first time to call a webservice function from actionscript in flash.  

i have the flash code working in preview mode - i.e. when i press F12 and it runs locally, i click the submit button and the code correctly calls the webservice function and returns the desired result.

however, when i export the movie, upload it to the live site and then browse to the site, the webservice function call no longer works - i dont get any return - its as if its not calling it at all or its crashing out somewhere during the call.

is there something different i need to do when deploying the movie, so that it will work on the live site?

here is the code for calling the webservice...

on (release)
{
      import mx.services.*;

      var strParam:String;
      var blnResult:Boolean;
      
      strParam= "test";
      ws= new WebService("http://www.myserver.com/ws.asmx?wsdl");
      cb= ws.fnTest(strParam);

      cb.onResult = function(result)
      {
            if (result == "true" ) {
                  txtSuccess._visible=true;
                  txtFailed._visible=false;
            }
            else {
                  txtSuccess._visible=false;
                  txtFailed._visible=true;
            }            
                        
      }      


}

as i said, this works fine in preview mode, but once i upload it to the server, it doesnt work.

please help!

thanks!
0
Comment
Question by:sdlangers
  • 2
3 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 125 total points
Comment Utility
You might need to add a crossdomain.xml file to your servers webroot. More details can be found all around.

-r-
0
 

Author Comment

by:sdlangers
Comment Utility
thanks - i had actually found the answer - this question is nearly 2 weeks old - it needed a proxy web service installed on the same domain - so its related to the crossdomain.xml solution you mentioned, so i'll just give you the points anyway
0
 
LVL 49

Expert Comment

by:Roonaan
Comment Utility
With crossdomain.xml you therefor don't need to run the flash and webservice on the same domain. Thats what it does.

But thank you for your points.

-r-
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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 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 what frame rate is, how to control it and what effect it has on the video.

763 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

8 Experts available now in Live!

Get 1:1 Help Now