Skip to main content
October 8, 2012
Question

How to consume a webservice from an as3 mobile app?

Does anyone have any ideas or thoughts on the best way to achieve this?

The app will be running on ios and andriod. Basically all i need to do is read/ write simple strings ie basic login info etc.

The app is a pure actionscript 3 mobile project built in flash builder 4.6.

Thanks in advance

Message was edited by: llanbu

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

October 9, 2012

Does anyone have any thoughts on this?

Thanks

Translate
Participant
October 9, 2012

Example:

private var nameWebService:WebService

private var serviceOperation:AbstractOperation;

private function useWebService():void{

          nameWebService.loadWSDL(urlWebService);

          nameWebService.addEventListener(LoadEvent.LOAD, onWaitingResponseWS);

}

private function onWaitingResponseWS():void{

          serviceOperation = nameWebService.getOperation("nameServiceWebService");

          serviceOperation.addEventListener(FaultEvent.FAULT, onFault);

          serviceOperation.addEventListener(ResultEvent.RESULT, onResult);

          serviceOperation.send(sendParameters);

}

private function onFault(event:FaultEvent):void{

          trace("Error");

}

 

private function onResult(event:ResultEvent):void {

          trace("ok");

}

PURE AS3

Translate
October 9, 2012

Thanks for the reply, which library(s) do i need to add to make use of 'Webservice' and 'AbstractOperation'?

I tried adding rpc.swc to the project, im getting the following errors when declaring nameWebService (private var nameWebService:WebService) -

1046: Type was not found or was not a compile-time constant: [mx.core]::IMXMLObject

1046: Type was not found or was not a compile-time constant: [mx.rpc]::IResponder

Translate