Home > AS3 > gofr available for download.

gofr available for download.

Apologies for not having my classes available for such a long period of time but they are back and can be downloaded here:

http://files.alducente.com/labs/WebService1.1.zip

Enjoy,

-Carlo

Categories: AS3 Tags:
  1. June 2nd, 2008 at 14:44 | #1

    Carlo,

    I believe I fixed a bug in these classes–let me know if I’m overlooking something. In WSProxy::onComplete, it always sets __busyOnCall to false when it completes. However, when calling multiple simultaneous requests, it seems that the __callQueue gets out of sync and the last __completeEvent would get called twice.

    I simply pushed “__busyOnCall = false” to an else block so it would only get set back to false after the queue was empty:


    if(__callQueue.length > 0){
    callService(__callQueue[0].load, __callQueue[0].req, __callQueue[0].path, __callQueue[0].soapAction);
    __callQueue.splice(0,1);
    } else {
    __busyOnCall = false;
    }

    This seems to be working solidly. Thoughts?

  2. June 2nd, 2008 at 15:24 | #2

    If it’s solid, keep using it! :) I haven’t had the time to look at these classes in a while, so please, do anything you want with them. Thanks for providing a solution!!

    -Carlo

  3. June 3rd, 2008 at 14:59 | #3

    For what it’s worth, another issue is that if a service errors out, the queue will *never* continue to execute, and your application hangs. To fix this, you add a listener for IOErrorEvent in the callService method:


    __urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onError);

    And continue the queue without completing the method (at the very least):


    private function onError(evt:IOErrorEvent):void{
    trace("*** WEB SERVICE ERROR ***");
    trace(evt.text);
    if(__callQueue.length > 0){
    callService(__callQueue[0].load, __callQueue[0].req, __callQueue[0].path, __callQueue[0].soapAction);
    __callQueue.splice(0,1);
    } else {
    __busyOnCall = false;
    }
    }

    I’ll let you know when this thing is finished in case you’d be interested where your stuff is being used.

  4. Jonson
    June 10th, 2008 at 21:36 | #4

    Hi, I have bought Adobe Flash CS3 Professional and found out thers not webservice in AS3 =(. I found this website and downloaded the webservice 1.1.zip. May i know what to do with the file? Thanks. I appreciate if you can email me back.

  5. June 25th, 2008 at 19:35 | #5

    Very nice Alducente! Just what I needed. Thanks to Francis too for the contributions. I am using this now and I’ll let you know if I come up with anything to add. So far this is the best ( and simplest ) approach I have found. Great job.

  6. Rick
    November 26th, 2008 at 10:20 | #6

    Hi!
    In the hunt for a good webService component for AS3 I found your sweet solution!
    Thanks!

    Only…
    I’m connecting to a webService that returns a “DataSet”..
    I’m new to AS3 and this may be a stupid question: How do I best parse the SOAP response so that I can iterate through and handle the requested data?

  7. February 26th, 2010 at 03:35 | #7

    Hi, thanks or putting this together. but I don’t understand how to use it. I am connecting to our webservice I think, but how do I call the services? what does this do: ws.ResolveIP(done2, “192.123.0.200″, 0);

    thanks!

  8. March 25th, 2010 at 08:05 | #8

    by Joey Lott and Danny Patterson
    Go to chapter 15 for a better and complete solution.

    My example code:
    private var xmlResults:XML = new URLLoader;
    private var urlLoader:URLLoader = new URLLoader();

    public function fErrorHandler(e:IOErrorEvent):void {
    trace(“xml failed!”);
    }

    //when the “loader” event object finishes the loading of the xml file, run other needed functions to process the data
    private function fLoaderCompleteHandler(event:Event):void {

    trace(“xml loaded!!”); //jwt testing
    var result2:XML = new XML(urlLoader.data); // loads the xml file data into the xml object
    xmlResults = result2; //have the global xml object equal the current data loaded xml object
    result2 = null; // dont need current xml object any more so erase it

    fParseXML(0); //process the first set of records from the xml object
    trace(“found xml” + xmlResults.toString());
    }

    public function fParseXML(intAddNum:Number):void{
    //create variables to store the record info
    //
    var envelope:XML = xmlResults; //XML(urlLoader.data);
    var soap:Namespace = envelope.namespace(“soap”);
    var responseN:Namespace = new Namespace(“http://www.domain.com/school/ServiceCollege”);
    var resultL:XMLList = envelope.soap::Body.responseN::HelloTestResponse.responseN::HelloTestResult;

    var strTest:String;
    //if only one response field will be return by the web service
    strTest = resultL;
    //do something like this if multiple response feilds will be returned
    //strTest = resultL.response::schoolName.toString();
    trace(“parsing:” + strTest);
    trace(“done loading:”);
    }

    public function fBeginRequest():void{
    var strXMLDataRequest:String
    var urlRequest:URLRequest = new URLRequest();
    urlRequest.contentType = “text/xml; charset=utf-8″;
    urlRequest.method = “POST”;
    urlRequest.url = “http://www.domain.com/school/serviceCollege.asmx”;
    var soapAction:URLRequestHeader = new URLRequestHeader(“SOAPAction”,”http://www.domain.com/school/ServiceCollege/HelloTest”);
    urlRequest.requestHeaders.push(soapAction);
    strXMLDataRequest = “<soap:Envelope xmlns:xsi=\”http://www.w3.org/2001/XMLSchema-instance\” xmlns:xsd=\”http://www.w3.org/2001/XMLSchema\” xmlns:soap=\”http://schemas.xmlsoap.org/soap/envelope/\”>”;
    strXMLDataRequest = strXMLDataRequest + “<soap:Body>”;
    strXMLDataRequest = strXMLDataRequest + “<HelloTest xmlns=\”http://www.domain.com/school/ServiceCollege\” />”;
    strXMLDataRequest = strXMLDataRequest + “</soap:Body>”;
    strXMLDataRequest = strXMLDataRequest + “</soap:Envelope>”;
    urlRequest.data = new XML(strXMLDataRequest);
    urlLoader.load(urlRequest);
    urlLoader.addEventListener(IOErrorEvent.IO_ERROR, fErrorHandler); //add the event to the “loader” object
    urlLoader.addEventListener(Event.COMPLETE, fLoaderCompleteHandler); //add the event to the “loader” object
    }

    Soap Request:
    <?xml version=”1.0″ encoding=”utf-8″?>
    <soap:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”>
    <soap:Body>
    <HelloTest xmlns=”http://www.domain.com/school/ServiceCollege” />
    </soap:Body>
    </soap:Envelope>

    Soap Response:
    <?xml version=”1.0″ encoding=”utf-8″?>
    <soap:Envelope xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:soap=”http://schemas.xmlsoap.org/soap/envelope/”>
    <soap:Body>
    <HelloTestResponse xmlns=”http://www.domain.com/school/ServiceCollege”>
    <HelloTestResult>string</HelloTestResult>
    </HelloTestResponse>
    </soap:Body>
    </soap:Envelope>

  1. No trackbacks yet.