Create A Webservice With Flash
well as the title indeicates is there a way to create a web service with actionscript? Java can. why should flash be any less.
now i know a web service is a very complex concept, but can it be done?
FlashKit > Flash Help > Actionscript 3.0
Posted on: 01-06-2008, 06:48 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
WebService Vs. Client Proxy And WebService Faults
Hi!
We've made a website in flash which fetches content from an ASP.NET 2.0 WebService on another server. The WSDL is on the same server as the flash.
When clients use the web site from behind a proxy, the service call fails. We've tried configuring one of our clients' proxy to ignore calls to the IPs of the servers, but there's no luck.
When trying to find out what's wrong, Flash' webservice component reports "Unable to connect to endpoint" no matter what the exception is on the server side. (Yes, it does find a service and get a result, but it's a fault message, not a connection exception)
Is there any way to find the correct exception, or configure the webservice component for use behind a proxy?
(The flash is using ActiveScript 2.0 for compatibility reasons)
Lars-Erik
WebService For Flash CS3
Annoyed that Flex has a WebService class, but Flash CS3 does not? You might want to check out this project:
gofr: AS3 Web Service
http://labs.alducente.com/?page_id=13
Blog post:
http://alducente.wordpress.com/2007/...s3-release-10/
Flash Using Webservice And Datagrid
Hey everyone,
I'm trying to build a flash application that loads external data from a database through coldfusion webservices. For instance, the application has a datagrid which is pulling in several values such as the user's first name, last name, phone number, etc, into each row of the datagrid. I'm brand new to this and desperately need help on how to pull in these values to the datagrid, allow users to add new users to it, edit and update the data. Also before each user can edit the data in the grid, he or she must login. Is there any resources or articles i could use to help me do something like this? Any help would be greatly appreciated it.
ASP.NET Webservice Not Consumable By Flash
I coded a webservice whose return type is DataSet in ASP.NET(3.5). When I added this webservice in Flash 8's authoring environment it completely resolved it's WSDL showing result of type array. But while binding this to a datagrid, it's showing nothing on triggering the web service. I am stuck on this since very long. Please HELP!!!
I suspect that may be DataSet data type is not recognisable by flash. If it is so then why it's resolving the schema of the function call with result of type array? Also if this is the case what should i give as return type in web service when i want to pass a set of data??
Webservice, Actionscript 3 And Flash
Hi,
a simple question : Is it possible to use webservice with actionscript 3.0 and flash?
I know it was possible with actionscript 2.0 and actionscript 3.0 with flex, but under flash....
Thanks,
Pascal
Webservice Fault When Flash Is Embedded
Hi,
Im using a webservice to retrieve data for my flash app. It all works fine in the flash IDE.
When I embedd the flash into the html or run the swf directly i get some permission issues, which i cant figure out how to adjust :s
Is the problem with my webservice, or the way im handling it within the flash?
I know thats kinda a broad question, so if you let me know what info you need to diagnose this ill provide it.
Heres a snippet of code for how im calling it:
_ws = new WebService(wsdlURI, _log);
_call = _ws.MyTestFunction();
_call.onResult = function(result) { handler(new XML(result)); };
_call.onFault = Delegate.create(this, traceFault);
Flash Client Connecting To WebService
Hi,
i'm working on a flash client that sends and receives data from a web service
(coded in J# if that matters).
we are a team of 3 and are currently working on a demo so we run tests on the company's network.
my machine - lets say Ronen.company.corp is holding a Windows IIS virtual directory with the swf and and html which embbed the swf.
my co-worker's machine - Lior.company.corp is also holding a Windows IIS virtual directory with the webservice.
when i run the flash client locally it works fine and i get the data from the WS, but when my co-workers get the flash client from Ronen.company.corp/app/index.htm - it doesnt work at all, they cannot access the WS.
i guess this is a security issue, how do i work around it?
thanks upfront.
Flash Debug Movie With Webservice
I have just recently started messing with Flash CS4 and I am trying to debug an issue I am having while connecting to a webservice. I have a compiled library of the Flex rpc classes in my flash movie and it works quite well with a webservice I created to get my twitter timeline in ASP.NET. Now I have new webservice I am trying to connect to and I keep getting the security untrusted movie error when I hit the service in debug. Specifically when I execute ws.loadWSDL().
Can anyone tell me how you debug a movie in the IDE when it is going out to the internet to consume a webservice?
I have added the movie to the Global Security Settings Panel, but it still pops the warning panel and then kills the movie everytime.
When I run the movie regularly it executes no problem and I get a result in my resultevent however I can't read the xml for some reason and thats why I need to debug so I can see what the format of the xml is.
Webservice And Flash Security Settings
I have a flash file that is making a call to a webservice on another domain. When I run the flash file it gives me the message where it says it's trying to communicate with this Internet-enabled location. I don't want to have the user to have to change their settings manually. Is there a way to allow the url of the webservice so the user does not have to change their settings?
Thanks,
Tony
Calling ASP.NET Session Value From Flash Via WebService
i'm calling a ASP.NET webservice method from flash to get specified ASP.NET session value.
The error i'm getting is:
Error opening URL "http://.......asmx"
Server.Connection
Unable to connect to endpoint: http://.......asmx
undefined
Notes:
1)You can come up with the idea controlling the url, i did it in ie address bar, it works.
2)You can come up with the idea that the session was not created, but i already do not test the codes in FLA mode by TestMovie.
FLA is published as swf, and it is in a container aspx page on the server.
And there is a login aspx page before accessing to this page. Here, if user infos are correct, specific session labels with values are
created and the user is redirected to this page. When flash loads, i call the webservice to get the Session value i desire(username).
For testing there's also an asp.net button where the swf exists, calling the same web service method. When i click it, the value
i desire returns back to me.
But when flash calls it, i get the error mentioned above.
My trouble is getting this server session value into a flash variable, and go on in presence.
Webservice And Flash Media Server
Hi all,
We have got the following task to do...in our organisation we've got an application that generates xml messages. We want to send these messages to Flash clients connected to an FMS server. In order to do that we want to create a webservice (ASP.NET) on the FMS server and let the application send the xml messages to that webservice. Once a message is received by the webservice we want to dispatch it to an FMS application where it would get parsed and based on the content in the message we want to call methodes (over rtmp) on the connected clients.
We have no background on FMS but we thought that it wouldn't be that hard to figure out. By the looks of it it seems almost trivial if you had to do it in Java or .Net. Not so in the world of FMS it seems. The major question we have got is: How do we feed the xml message received by the webservice to an FMS application...or (another solution) how do we notify an FMS application that a new message was received by the webservice. The Google or the manual don't contain examples of any such scenarios. Which makes us asking, "Are we on the right track? Is this the best way to do it?".
Any suggestions, solutions and wisdom are welcome.
Thanks in advance.
Erik
Flash WebService Component Problem
Hello,
I am making a flash login page using WebService component. When I test the the login page by loading it from my hardrive everything runs fine. When I say "run fine" I mean the verification process is completed by the WebService component, cfc file and the database (which both are on a server). However, if I upload the flash login page to the server and I run it from there, then nothing happens. Is the problem in the server or I should look more into my code?
Thank you.
Flash WebService Component Problem
Hello,
I am making a flash login page using WebService component. When I test the the login page by loading it from my hardrive everything runs fine. When I say "run fine" I mean the verification process is completed by the WebService component, cfc file and the database (which both are on a server). However, if I upload the flash login page to the server and I run it from there, then nothing happens. Is the problem in the server or I should look more into my code?
Thank you.
Flash Reading Image File From Webservice
Hi guys,
I want to download an image from a webservice. What would i potentially need in flash to get it working?
I came up with the following strategy:
Use a Bytearray to read in byte data of the image from the webservice. Each webservice call would return a different set of bytes, use these bytes to build the image in flash.
I am not too sure about the specifics either, (i also need help on this). For example, I believe i need to use the ByteArray class and do I need to get a raw socket hooked up to the server or is just using the return data from the webservice and making another call sufficient?
I am targeting AS3, however if anyones has done it in AS2 or can come up with it in AS2 then please post, it will help.
Any help is much appreciated.
[Flash 8] Issues Extending WebService Class
Greetings everyone, hopefully someone can shed some light on a problem I am having.
I would like to extend the WebService class in order to add a couple of functions to it. The problem is, when I use the subclass, I get the following message:
'Error opening URL "file:///<PATH WHERE FLA IS SAVED>/undefined"'
The subclass looks like this:
Code:
import mx.services.*;
class com.testing.TestWebService extends WebService{
var foo:String;
//constructor
function TestWebService(){
foo = "TestWebService";
}
}
And the FLA code looks like this:
Code:
import com.testing.*
var testWebService:TestWebService = new TestWebService("http://honkytonk:4242/OrcaSASoap/wsdl.xml");
trace(testWebService.foo);
The strange thing is, if I extend the MovieClip class instead of the WebService class, everything is peachy. This makes me think there is something that I am missing, or do not know about the WebService class.
FYI: The code above is the "I want to get it to load without errors" example. My reasons for extending the class go beyond adding a "foo" property.
NOTE: The WSDL path is to my local machine and therefore not accessible to the masses. Any WSDL should recreate the same results.
Webservice
import mx.services.*;
paswd_mc.onRelease = checkmail;
function checkmail(){
if (_root.login.usr_txt.text == ""){
_root.login.usr_txt.text = "enter E-mail!!!";
}else{
var checkEmailService = new mx.services.WebService("http://www.webservicex.net/ValidateEmail.asmx?WSDL");
checkEmailResultOb = checkEmailService.IsValidEMail(_root.login.usr_txt .text);
checkEmailService.onLoad = trace("loading");
checkEmailResultOb.onResult = function(result) {
trace("the email is " + result);
}
checkEmailResultOb.onFault = function(fault){
trace('error');
}
MailVars = new LoadVars();
MailVars.mailAdr = _root.login.usr_txt.text;
MailVars.sendAndLoad("scripts/check.asp", MailVars, "POST");
}
}
He's constantly saying:
Scene=Scene 1, Layer=actions, Frame=1: Line 1: ';' expected
import mx.services.*;
And I don't see where he needs the ;
XML To ASP.NET Webservice
I am looking for something that will help me through the whole process... I am looking to transfer a flash created xml file to an ASP.NET webservice however my google search has been fruitless. If anyone has some hints on this subject I would be most grateful for the help... thanks!
Help With Webservice...
ok....i am building a roulette game.i am trying to receive and use in the fla some values passed by the webservice.
The problem is that i cannot use data outside the functions,as the pending call response is sent via parameter to the function attached.PLEASE HELP,i am losing my mind over here.
here is the code.
import mx.services.WebService;
import mx.services.PendingCall;
var sAdr:String="http://numberware.com/number.asmx?WSDL";
var wsNumar:WebService=new WebService(sAdr);
var pcCdate:PendingCall=wsNumar.Now();
var pcCastig:PendingCall=wsNumar.Random();
var pcUrmatoar:PendingCall=wsNumar.Interval();
pcCdate.onResult = function(nRate):Void{
n=nRate;//<---n is what i'm trying to use in the rest of my file
};
pcCastig.onResult = function(nr):Void{
trace(nr);//<---nr is what i'm trying to use in the rest of my file
};
pcUrmatoar.onResult = function(date):Void{
trace(date);//<---date is what i'm trying to use in the rest of my file
};
Webservice Url
how can we dynamically load webservice url from actionscript to the mxml file
Webservice In AS 3.0
Hi
Is there any Webserviceclass in AS3.0, How can I use the XMLclass instead?
// Olof
WebService Bug
I am trying to execute the following code:
var wsdlURI = "
WebService
hi There, I've a doubt about a job done, but now it's need to be modified, thing is the flash file feeds the info from a public and free WebService, in this case I'm using drop down components so people can choose between us dollar or euro, then compare this option to mexican peso and then, place the conversion in some text field, now my client needs this automatic, this means, user do not have to click nothing, just a text with this info:
US Dollar: 10.278 / Euro: 12.987
is this possible?, my actionscript is this:
// Inicio cambios de estilos de DropDowns componentes
cmbMoneda1.setStyle("selectionColor", 0xFFFFFF);
cmbMoneda1.setStyle("rollOverColor", 0xA0ADC0);
cmbMoneda1.setStyle("backgroundColor", 0xFFFFFF);
cmbMoneda2.setStyle("selectionColor", 0xFFFFFF);
cmbMoneda2.setStyle("rollOverColor", 0xA0ADC0);
cmbMoneda2.setStyle("backgroundColor", 0xFFFFFF);
// Fin cambios de estilos de DropDowns componentes
//************************************************** ***********
// Inicio Funcion Cambio de Divisas
//Creamos un objeto nuevo del tipo objeto
var on_Release = new Object();
//Declaramos la función que se va a realizar cuando se haga clic
on_Release.click = function(evt) {
//Limpiamos la caja de texto
txtCambio.text = "";
//Lanza la función del webservice
_root.wsConversor.trigger();
};
//Asignamos el Listener al componente botón
botCambio.addEventListener("click", on_Release);
// Fin Funcion Cambio de Divisas
You can check the .FLA file on
www.videoestudio.net/divisas/divisas.fla
or
check the .SWF file on:
www.videoestudio.net/divisas/divisas.swf
hope somebody here can help me on this, thanks a lot!!!
Arturo
Webservice Help
I am trying to pass an object to a web service call in flash. I need the output of the webservice call to have multiple questions with the same xml tag name.
//setup webservice
var webService:WebService;
webService= new WebService(ws);
webService.getCall.concurrency(SOAPCall.MULTIPLE_C ONCURRENCY);
webService.getCall.doLazyDecoding(true);
//create object to pass to the service
var SurveyRequest:Object = new Object;
SurveyRequest.surveyName = "my survey";
SurveyRequest.question = getAnswer();
//pass object into webservice
var IDResult:Object = new Object();
IDResult = webService.getRequest(SurveyRequest);
//handle webservice result
IDResult.onResult = function(result)
{
}
//function to return an object containing the question data
public function getAnswer():Object
{
var Q0:Object = new Object;
var A0:Object = new Object;
A0.answer = "my answer";
Q0.answer = A0;
Q0.qTitle = "my question";
return Q0;
}
When the webService.getRequest(SurveyRequest); is called, it creates an xml structure similar to...
<SurveyRequest>
<surveyName>my survey</surveyName>
<question><qTitle>my question</qTitle><answer>my answer</answer></question>
</SurveyRequest>
What I need is to have multiple questions added to the survey, but they must have the same tag name.
It should look something like
<SurveyRequest>
<surveyName>my survey</surveyName>
<question><qTitle>my question</qTitle><answer>my answer</answer></question>
<question><qTitle>my question2</qTitle><answer>my answer2</answer></question>
<question><qTitle>my question3</qTitle><answer>my answer3</answer></question>
</SurveyRequest>
Thank you for your help .
Webservice
Hello
I'm a complete newbie to flash and actionscript. Have been asked to update flash clip a developer wrote who has now left the componay.
I have been banging my head against a Actionscript wall alll week,
I need to connect a flash clip from our South African server, via a webservice, to our german server.
I somehow managed to connect within the flash development environment, a couple of time, now it's broken again. On the live sites I just cannot get it to connect.. all kinds of errors, like "Error loading WSDL", "Wrong WSDL Format" or it connects and just sits there. Executes the webservice method call, but no result, no error.. nadda. Tried crossdomain.xml on our german server, tried local proxy.php route... NOTHING
The webservice is on http://intranet.tray-international.c...nchservice.php. One of the methods I need to use is GetBranchDetailsXML(str_xml_request), with str_xml_request = "<request><branch>104</branch></request>";
If there is anyone out there capable of making a simple connection to this service, and get back the XML returned, pls let me know how you did this. I've run out of google search terms
.Net Webservice
I looked through these forums, and haven't found an answer yet. In Flash MX 2004, I have read that you can't return a dataset from a .Net webservice and have flash be able to process it. But instead you should return an array.
Is this still true for Flash 8?
Thanks!
Webservice Connector?
i'm using the webservice connector and I can't get the params to pass correctly?
if a checkbox is selected i want it to use that as the param for the web service.
if another is checked i want it to use that as it's param. I can't even assign a param to get it to work, why not?
getCityNames.params = [akron];
getCityNames.params = (akron);
getCityNames.params = ("akron");
none work???
NFL Webservice Or XML Connection
Hi,
I want to build an application to display NFL results and i was wondering if anybody knows about a webservice connection or xml file, which is continously updated and can be downloaded, similar to weather service.
WebService & Base64Binary ? How To?
I´m consuming a webService using the WebServiceConnector. The service gives me a name, and a photo of someone. The problem is that the name comes as a String but the photo is not an URL, it´s a base64Binary. How can i view this image with Flash?
Should i link the foto (base64Binary) result to which object? I have tries the Loader component, a empty MovieClip and nothing...
If i link that result to a textField it will show a huge code!!!I guess that´s the binary of the file....
Any help please?
AS 2.0 Problem With Webservice
Hello everyone,
I'm having a problem with consuming a webservice in Actionscript 2.0. I've determined that I can hit it with Flex 3, and ActionScript 3, but not 2.0. Are there any Guru's that can tell what I'm doing wrong in AS 2.0?
Thanks in advance!!
Here's the code that I'm using for AS 3.
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.xml.*;
import flash.events.IOErrorEvent;
var loader:URLLoader;
function KickPaulInTheButt()
{
Security.loadPolicyFile("xmlsocket://www.gastineautechnical.com");
var request:URLRequest = new URLRequest("http://www.gastineautechnical.com/WebServices3.asmx/Login?username=dave&password=test");
loader = new URLLoader();
try
{
loader.load(request);
}
catch (error:SecurityError)
{
trace("A SecurityError has occurred.");
}
loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.addEventListener(Event.COMPLETE, loaderCompleteHandler);
}
function errorHandler(e:IOErrorEvent):void
{
trace("DAM! an Error!");
}
function loaderCompleteHandler(event:Event):void
{
trace("It came back");
trace(event.target.data);
}
KickPaulInTheButt();
/*
import mx.services.*;
trace("running AS");
// Creates a Log object which records all events when calling a web service.
wsServiceLog = new Log(Log.VERBOSE);
wsServiceLog.onLog = function(txt) {
trace(txt);
}
trace("Pre login WS call");
var returnedValue:Object;
var wsURL:String = "http://www.gastineautechnical.com/WebServices3.asmx?WSDL";
var ws:WebService = new WebService(wsURL,wsServiceLog);
trace("loaded the webservice");
var re:PendingCall = ws.Login("dave","test");
trace("Pending call");
ws.onLoad = trace("ws.onLoad");
re.onResult = function(result):Void
{
trace("in result");
returnedValue = result;
trace("Returned: "+ returnedValue);
};
re.onFault = function(fault)
{
trace("in fault");
returnedValue = fault.faultCode+","+fault.faultstring;
trace(returnedValue);
};
trace("END");
*/
The 2.0 code that I can't get to work is:
//import the Classes needed for the application import mx.remoting.*; import mx.rpc.*; import mx.services.*; import mx.data.*;
var myService:WebService = new WebService("http://www.gastineautechnical.com/WebServices3.asmx?WSDL
", new Log());
var serviceCall:PendingCall=myService.Login("username" ,"pass");
serviceCall.onResult=function(result:Object){
trace(result);
}
stop();
Webservice Problem
Hello, i have created flash movie thats connect to webservice. when i am testing to flash application using ctrl+enter. The flash movie is working properly and its loading the data from webservice.. but when i published it and try it in the web it gave me pop-window that is saying:
"Adobe Flash Player Security.
Adobe Flash player has stopped a potentially unsafe operation."
What does that mean. What if i load the html in localhost will it solve the issue?
Thanks.
[F8] Webservice Security
Im have application that connect to webservice when i test it locally all are working fine. Im having connection to the webservice and all data are loaded. But when i published it, the viewed it in HTML. I'm having pop-window that says
"Adobe flash Player Security"
Adobe has stopped a potentially unsafe operation
The following local application on your computer or network"
d:documentflash.swf
How can i prevent this from happening and make my flash.swf establish communication to the webservice without appearing this pop-up window.
WebService /Component Help
I have a component that calls a webservice with two methods, retreives some values and animates a dial....
My problem at the moment is that after it has retreived the values, and animated the component, it still sits there saying 'Transfering from 127.0.0.1...' <-- host of where the webservice is at the moment.
It seems to crash the web browser as it tries over and over to get the values.
What is the correct way to use the webs service?
Here is the first call function:
var wsService:WebService = new WebService("http://127.0.0.1/WS/Service1.asmx?WSDL");
wsService.onLoad = trace("Loading Database Data...");
var wsGetAllVals:PendingCall = wsService.GetSensorValueAll(sensorID);
var wsObject:PendingCall = wsService.GetSensorValue(sensorID);
trace(sensorID)
var me = this; // in openService()
wsGetAllVals.onResult = function (result)
{
me.sensorMax = "400";
trace("All Values received");
trace("-----------------");
var splitArr:Array = result.split(";");
me.sensorMax = me.lblMax = splitArr[6].substring(9,15);
me.sensorMin = me.lblMin = splitArr[5].substring(9,15);
me.lblUnit = splitArr[3].substring(6,40);
trace(splitArr);
trace("-----------------");
_root.sensorMax = me.sensorMax;
_root.sensorMin = me.sensorMin;
}
Thanks heaps!
WebServiceConnector --> WebService Help
Hi,
I realized too late in this project (like I need it now ) that I need error handling which the WebServiceConnector does not seem to offer me such as .onFail.
Is there a way I can do error checking the the WebServiceConnector class?
If not..
I have my own classes which I would like to convert to the WebService class if possible although it seems I may not be able to simply extend the WebService class with the component in my library.
Please can you offer some assistance how I would convert the following example class.
ActionScript Code:
import DataTransferLayer.*;
import BusinessLayer.*;
import DataAccessLayer.BaseDatabase;
class DataAccessLayer.EventDetailDataAccess extends mx.data.components.WebServiceConnector implements DataAccessLayer.IEventDetailDataAccess
{
private static var EVENT_LISTENER_RESULT:String = "result";
private static var GET_EVENTS:String = "getEvents";
private var caller:Object;
private var _eventSetup:EventSetup;
private var baseDatabase:BaseDatabase;
var detail:Array;
var eventDetailResults:Object;
function EventDetailDataAccess(setCaller:Object)
{
//Constructor code
baseDatabase = new BaseDatabase();
caller = setCaller;
}
private function GetEventDetailFromWebService():Void
{
this.addEventListener(EVENT_LISTENER_RESULT, EventDetails);
this.WSDLURL = _eventSetup.GetEventDetailWebServiceURL();
this.suppressInvalidCalls = true;
this.trigger();
}
private function EventDetails(evt:Object)
{
eventDetailResults = evt.target.results;
var eventDetail:EventDetailData = new EventDetailData();
for (var resultCount = 0; resultCount<eventDetailResults.length; resultCount++)
{
//TODO: temp if until web service accepts params
if(baseDatabase.Trim(this.params[0]) == baseDatabase.Trim(this.eventDetailResults[resultCount].code))
{
eventDetail.Id = this.eventDetailResults[resultCount].id;
eventDetail.StartDate = this.eventDetailResults[resultCount].startDate;
eventDetail.EndDate = this.eventDetailResults[resultCount].endDate;
eventDetail.Location = this.eventDetailResults[resultCount].location;
eventDetail.Code = this.eventDetailResults[resultCount].code;
eventDetail.Title = this.eventDetailResults[resultCount].title;
eventDetail.TypeCode = this.eventDetailResults[resultCount].typeCode;
}
}
caller.LoadFromResults(eventDetail);
}
function GetEventDetail(eventSetup:EventSetup):Void
{
_eventSetup = eventSetup;
this.operation = GET_EVENTS;
this.params = [""];
GetEventDetailFromWebService();
}
}
Get Data From WebService To XML
Hi
Im having some issues on how to translate a returned Object from the WebService and i would like to know if someone can help me?
The WebService is something like this:
Code:
<WebService(Namespace:="Gallery Slides")> _
Public Class GetPhotos
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetSlides() As DataSet
Dim DataConn As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString)
Dim MyAdapter As New Data.SqlClient.SqlDataAdapter("SELECT TOP 10 ImageId, Thumbnail, ToolTip FROM ConcertImages WHERE Active = 1 ORDER BY NEWID()", DataConn)
Dim MyDataSet As System.Data.DataSet = New Data.DataSet
DataConn.Open()
MyAdapter.Fill(MyDataSet)
DataConn.Close()
Return MyDataSet
End Function
End Class
Then the ActionScript:
Code:
import mx.services.*;
MonWebService = new WebService("http://www.somesite.net/GetPhotos.asmx?wsdl", new Log());
serviceCall = MonWebService.GetSlides();
serviceCall.onResult = function(result) {
trace(result);
};
This returns an object:
3/30 4:12:3 [INFO] : Queing call GetSlides
3/30 4:12:4 [INFO] : Made SOAPCall for operation GetSlides
3/30 4:12:4 [INFO] : Invoking previously queued call GetSlides
3/30 4:12:4 [INFO] SOAP: Asynchronously invoking SOAPCall: GetSlides
[object Object]
If i use this ActionScript: (result.diffgram - is the difference)
Code:
import mx.services.*;
MonWebService = new WebService("http://www.somesite.net/GetPhotos.asmx?wsdl", new Log());
serviceCall = MonWebService.GetSlides();
serviceCall.onResult = function(result) {
trace(result.diffgram);
};
I get:
3/30 4:14:13 [INFO] : Queing call GetSlides
3/30 4:14:13 [INFO] : Made SOAPCall for operation GetSlides
3/30 4:14:13 [INFO] : Invoking previously queued call GetSlides
3/30 4:14:14 [INFO] SOAP: Asynchronously invoking SOAPCall: GetSlides
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"><NewDataSet xmlns=""><Table diffgr:id="Table1" msdata:rowOrder="0"><ImageId>17</ImageId><Thumbnail>images/concerts/tn_827591.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table><Table diffgr:id="Table2" msdata:rowOrder="1"><ImageId>13</ImageId><Thumbnail>images/concerts/tn_140494.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table><Table diffgr:id="Table3" msdata:rowOrder="2"><ImageId>2</ImageId><Thumbnail>images/concerts/tn_466260.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table><Table diffgr:id="Table4" msdata:rowOrder="3"><ImageId>30</ImageId><Thumbnail>images/concerts/tn_312246.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table><Table diffgr:id="Table5" msdata:rowOrder="4"><ImageId>37</ImageId><Thumbnail>images/concerts/tn_718532.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table><Table diffgr:id="Table6" msdata:rowOrder="5"><ImageId>5</ImageId><Thumbnail>images/concerts/tn_664167.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table><Table diffgr:id="Table7" msdata:rowOrder="6"><ImageId>3</ImageId><Thumbnail>images/concerts/tn_391945.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table><Table diffgr:id="Table8" msdata:rowOrder="7"><ImageId>9</ImageId><Thumbnail>images/concerts/tn_380003.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table><Table diffgr:id="Table9" msdata:rowOrder="8"><ImageId>32</ImageId><Thumbnail>images/concerts/tn_294888.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table><Table diffgr:id="Table10" msdata:rowOrder="9"><ImageId>4</ImageId><Thumbnail>images/concerts/tn_969281.jpg</Thumbnail><ToolTip>Last Concert</ToolTip></Table></NewDataSet></diffgr:diffgram>
The point is how can i get this results into XML?
Thanks in Advance
Cheers
Problem With Webservice
I don't know how to parse a webservice.
Hope someone can help. I call a method named GetAll() and it returns an object [n]. Inside that object [n], there is differents variable but I can't reach them. How can I reach PostingDate, Title, Category and the others ?
Thanks
Code:
import mx.services.*;
var myWS = new WebService("http://ws.cisa.ca/WehireWS/JobsWs.asmx?WSDL", new Log());
myWS.onLoad = function(pWSDL:String) {
var test = this.GetAll();
test.onResult = manageResult;
test.onFault = manageFault;
};
myWS.onFault = function() {
trace("error");
};
manageResult = function (wsResult) {
trace("retour : "+wsResult);
};
manageFault = function () {
trace("error");
};
SOAP And WebService
I'm trying to send SOAP requests with WebService.
WebService.loadWSDL seems to load the configuration stuff. I know I can use getOperation, then Send to send things, but the callbacks from the AsyncToken never seem to get called.
Am I doing things right? I don't want to do this with the UI XML; I want to do it in ActionScript.
I'm not sure Send is what I really want to do, and I'm not sure what the parameters are for a remote call.
Say I have
Code:
<SomeOperation xmlns="http://foo.com/file">
<Parameter1>foo</Parameter1>
<Parameter2>bar</Parameter2>
</SomeOperation >
the xmlns and SomeOperation part should have been parsed with loadWSDL (I think). I'm not sure how to send the parameters. I tried making XML objects with Parameter1 as the root, but I didn't get a response.
Pointers, examples, and anything else would be appreciated.
Thank you!
WebService, XML, DateTime
When I send an argument off to WebService, I can't get the time right. The xsd file says Time is an XML DateTime. Whatever I do, I keep getting this on the other end:
Code:
<tns:Time>
<tns:Time xsi:nil="true"/>
</tns:Time>
I've tried passing XML("<Time>2007-10-09T07:15:42.18Z</Time>"), the same with XML Document, and actual XML (since that's legal actionscript). No matter what I do, I get the above nested XML.
I had a similar problem with XML strings when I used a string argument or an XMLDocument.
Code:
<tns:Foo>text</tns:Foo>
That's what the other entries look like (and what they're supposed to look like). They are XML Strings, not XML DateTimes.
Getting At XML Returned By WebService
Hello everyone,
I hope this is the correct group to post this question, etc. etc.
I am four days new to Flex development using FlexBuilder 3.
I have written a very simple .NET web service that returns the following XMLDocument when invoked:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<fabrics>
<fabric>
<color>Yellow</color>
<price>3</price>
</fabric>
</fabrics>
I have the following WebService result handler in my application:
Code:
public function handleXML(event:ResultEvent):void
{
var fabricList:XML = XML(event.result);
fabricProvider = new XMLListCollection(fabricList.fabric)
fabricInfoList.dataProvider = fabricProvider;
}
Which fails to populate the datagrid (fabricInfoList) correctly, because event.result contains the SOAP XML wrapper (<GetFabricsResponse ... etc.) with the XML fragment I actually want buried in the <GetFabricsResult> element of the SOAP response.
I have spent the entire day trying to find examples of how to pull out the actual response value of the event.result object, but I have not found anything. The result handler works just fine when I hardcode the values like so:
Code:
public function handleXML(event:ResultEvent):void
{
var fabricList:XML =
<fabrics>
<fabric>
<color>Yellow</color>
<price>3</price>
</fabric>
<fabrics>
fabricProvider = new XMLListCollection(fabricList.fabric)
fabricInfoList.dataProvider = fabricProvider;
}
So I feel very confident that it is simply a matter of getting past the SOAP wrapper and pulling out the actual value. Can anyone reveal the mystery for me?
Thanks in advance,
Jason
WebService And Crossdomain.xml... Again
Well, I know that there are some threads concerning this topic already.
But from my point of view, it should work fine:
I call the webservice http://www.webservicex.net/stockquote.asmx?WSDL .
I works fine when I test the app on my local machine.
But when I upload the flash app and test on my server, it doesn't work - "Security error accessing url".
Well, of course the webservices server needs a crossdomain.xml... and it has one in its root directory. See yourself:
http://www.webservicex.net/crossdomain.xml
But I get this error.
Loading the policy file before with Security.loadPolicyFile("http://www.webservicex.net/crossdomain.xml") doesn't help.
Any ideas?
Polling A WebService
Hello
I'm new at Actionscript and Flash and I'm trying to hit a webservice every X seconds to get data back and refresh the Flash. I've got the data stuff down and it's displaying, but I need it to hit the webservice and refresh itself automatically.
import mx.services.*;
var service = new WebService("http://localhost/foo.asmx?wsdl");
result = service.GetIt();
service.onLoad = trace("loading");
result.onResult = function(result)
{
trace("Market: " + result[0].ID);
trace("MarketID: " + result[0].Desc);
Item1Value = result[0].Desc;
}
Timer And WebService AS3
Hi all i got a problem and is that whenever i got a timer on , and its set to infinite loop e.g new timer (1000 , 0 ) ; and after that i will have to insert new rows into database ... However i found out a problem is that will timer sometimes prevent data from successfully inserting the data into a new row of the databasE ? thats because sometimes the data will get inserted into database and sometimes it wont ...
is it because i execute the command juz when the timer time is up ?
i nid some help please ... thanks
Weborb & Webservice
Hi all , i am tryin to use weborb for my chinese checker board game development. Previously , im usin well-considered webservice class for connecting of user to passing of game moves ... However , well-considered only support client pull technology from the webserver which MUST be initiated by the client . i put timer on the client side but however i want it to have a real time basis in the sense that i want client make a move and SERVER PUSH to all other client using weborb
/*import be.wellconsidered.services.WebService;
import be.wellconsidered.services.Operation;
import be.wellconsidered.services.events.OperationEvent;
var ws = new WebService("http://MCCCU-PC999/ChineseCheckerWebsite/WebService.asmx?WSDL");
var opCreateRoom : Operation = new Operation(ws);
opCreateRoom.addEventListener(OperationEvent.COMPL ETE, onResult);
opCreateRoom.setRoomInfo(Room_Name, Room_Password,room_players,room_detect); (AS3)
Like here is how i use the well considered class to connect to the webserver and create the room ..
The question is how can i create equivalent code of the above using weborb AS3
any help will be appreciated ...
AS3, Xml And Webservice Problem
Heya, i'm having some troubles with this project i'm working on where i need to access an access-database from flash. I've written a webservice which works fine and managed to access the resulting xml-file in flash, but i can't seem to sort out the specific data i want from it.
ActionScript Code:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
var xml:XML;
function onLoaded(e:Event):void
{
xml = new XML(e.target.data);
trace(xml);
}
loader.load(new URLRequest("http://localhost:1492/Lab3/Lab3Service.asmx/getAllData"));
This results in the following "output" in flash:
Code:
<ArrayOfUsrData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<usrData>
<posX>100</posX>
<posY>200</posY>
<name>gubb</name>
<email>a@b.c</email>
</usrData>
<usrData>
<posX>200</posX>
<posY>100</posY>
<name>test</name>
<email>asd</email>
</usrData>
</ArrayOfUsrData>
Now, i'v found in noumerous forums and books that the way to trace a specific post in an xml-file is to use dots. I've tried using trace(xml.usrData) and trace(xml.ArrayOfUsrData) but these return nothing.
My best guess of how to lets say access the posX-value of the upper usrData would be trace(xml.usrData.posX.text()[0]);
(The "text()" method is supposed to return the value without its wrapping tags.)
Anyone who has an idea of what i'm doing wrong?
Webservice Connection
Hi,
I've made a couple of flash movies that uses webserviceconnector to retrieve some data using Actionscript 2.0 .
It all work fine from the development environment (Flash CS3) but not after publish. The data does not show up. I've tried the following:
- "executed" the html file by doubleclick
- executed the SWF file
- put the html and SWF on my localhost and accessed it through the browser.
It has to be a simple answer and I guess it has something to do with new security features but I can not find the answer.
Any answer is highly appreciated, thanks.
WebService Refresh
Hi,
My flash is consuming a webservice as follows:
var wsConn:WebServiceConnector = new WebServiceConnector();
wsConn.addEventListener("result", getGroups);
wsConn.WSDLURL = "
Webservice Connector
I'm trying to use a webservice connector component. I have specified the url as localhost/server.php?wsdl. This is returning valid wsdl (i've checked) and flash is accepting it without complaining. However, when I check my schema tab in the component inspector rather than having the operations specified it has 'params : Object' and 'results : Object'. It doesn't have the operation name defined in wsdl. Is this normal? How do I call my operation from flash?
In the flash example it comes up with 'product : string' below the 'params : Object'. My wsdl defines one operation with an input of two integers. Surely these should come up in the schema tab.
What am I doing wrong?
Pb Webservice Flash8
Hello everyone!
first pls excuse my english...
I'm trying to get data from a webservice placed on an other server, parse the data and display it in a datagrid.
I'm using the WebServiceConnector component.
I placed a crossdomain.xml on the remote server, allowing my domain
(<allow-access-from domain="*.mydomain.corp" secure="false" />)
Everything works fine within Flash. (Ctrl+Enter)
Data is recovered, parsed and diplayed propoerly.
But when i try somewhere else, it doesn't work at all.
(local swf, local html, nor in http on mydomain)
I placed dynamic txt fields to trace the status of the webserviceconnector, throught a listener on "status" event.
I have of course an other listener for "result" event, which launches parsing and display.
Within Flash, i see the "status" changing from
"StatusChange" {callsInProgress:1}
to
"StatusChange" {callsInProgress:0}
and then, the "result" event is triggered.
But when trying online, the "status" stays on
"StatusChange" {callsInProgress:1}
and the "result" event is never triggered.
Looking on the httpheaders of the page, i can see the webservice is called with success (Method:GET Result:200, Type text.xml;charset=utf-8).
I though it was a security issue, so in my html, i set
<param name="allowScriptAccess" value="always" />
And in my flash, i put:
System.security.allowDomain("*");
System.security.allowInsecureDomain("*");
And still, i can't access the data...
Any idea ?
Thanks thanks thanks
Pb Webservice Flash8
Hello everyone!
first pls excuse my english...
I'm trying to get data from a webservice placed on an other server, parse the data and display it in a datagrid.
I'm using the WebServiceConnector component.
I placed a crossdomain.xml on the remote server, allowing my domain
(<allow-access-from domain="*.mydomain.corp" secure="false" />)
Everything works fine within Flash. (Ctrl+Enter)
Data is recovered, parsed and diplayed propoerly.
But when i try somewhere else, it doesn't work at all.
(local swf, local html, nor in http on mydomain)
I placed dynamic txt fields to trace the status of the webserviceconnector, throught a listener on "status" event.
I have of course an other listener for "result" event, which launches parsing and display.
Within Flash, i see the "status" changing from
"StatusChange" {callsInProgress:1}
to
"StatusChange" {callsInProgress:0}
and then, the "result" event is triggered.
But when trying online, the "status" stays on
"StatusChange" {callsInProgress:1}
and the "result" event is never triggered.
Looking on the httpheaders of the page, i can see the webservice is called with success (Method:GET Result:200, Type text.xml;charset=utf-8).
I though it was a security issue, so in my html, i set
<param name="allowScriptAccess" value="always" />
And in my flash, i put:
System.security.allowDomain("*");
System.security.allowInsecureDomain("*");
And still, i can't access the data...
Any idea ?
Thanks thanks thanks
|