Hi Danko,
Are you sure its trying to load up the other WSDLs?
service = ServiceLocator.getInstance
> ().getWebService"publicWebService") as WebService; // this is the
> line which brings up error
has an error, as its missing a ( I have updated it below
service = ServiceLocator.getInstance
> ().getWebService("publicWebService") as WebService; // this is the
> line which brings up error
Not sure if this is a cut and paste error on your behalf... or your
problem...
Regards
Mark
--- In cairngorm-devel@yahoogroups.com, "Danko Kozar"
<danko_kozar@...> wrote:
>
> I've got a problem with ServiceLocator, and that problem didn't
> exist until my today's Flex & Cairngorm upgrade (to Hotfix 2 +
> Cairngorm 2.2).
>
> Context:
> --------
> In my <mx:ServiceLocator> I've got 3 web services defined, one of
> which is a public one (the others are protected). "Public" means
> it's not secured on the server and contains only "login(user, pass)"
> method (and it has a known URL in the application start). After the
> successfull login, the login method returns WSDL URLs of all other
> web services.
>
> Problem:
> --------
> The problem is that a service locator IMMEDIATE LOADS ALL WSDL-s of
> it's (web service) children. But: this happens only when the
> ServiceLocator is referenced FROM THE DELEGATE CLASS (using 'service
> = ServiceLocator.getInstance().getWebService("publicWebService") as
> WebService;'). When it is referenced from the main page, this
> problem doesn't exist. Of course, these other web services doesn't
> have proper WSDL-s assigned yet, so I got an error.
>
> Note: I HAVE TO reference the web service from the delegates since I
> have to invoke web service methods from that delegates.
>
> Since I didn't quite understand what's going on here, please give me
> some advice. Thanks!
>
> Code:
> -----
>
> public class LoginDelegate
> {
> private var responder: IResponder;
> private var service: WebService;
>
> public function LoginDelegate(responder: IResponder)
> {
> service = ServiceLocator.getInstance
> ().getWebService"publicWebService") as WebService; // this is the
> line which brings up error
> this.responder = responder;
> }
>
> public function login(user:String, pass:String):void
> {
> var token:AsyncToken = service.Login(user, pass);
> token.resultHandler = this.onResult;
> token.faultHandler = this.onFault;
> }
>
> //-----------------------
> protected function onResult(event:ResultEvent):void
> {
> responder.result(event);
> }
> protected function onFault(event:FaultEvent):void
> {
> responder.fault(event);
> }
> }
>
> Error Detail:
> -------------
> TypeError: Error #1009: Cannot access a property or method of a null
> object reference.
> at business::Services/__mainWebService_fault()
> at
> flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE
> ventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at mx.rpc::AbstractService/dispatchEvent()
> at mx.rpc.soap.mxml::WebService/dispatchEvent()
> at mx.rpc.soap::WebService/loadWSDL()
> at com.adobe.cairngorm.business::WebServices/register()
> at
> com.adobe.cairngorm.business::ServiceLocator/get ::webServices()
> at com.adobe.cairngorm.business::ServiceLocator/getWebService
> ()
> at business::LoginDelegate$iinit()
> at command::LoginCommand/execute()
> at
> com.adobe.cairngorm.control::FrontController/com.adobe.cairngorm.cont
> rol:FrontController::executeCommand()
> at
> flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchE
> ventFunction()
> at flash.events::EventDispatcher/dispatchEvent()
> at
> com.adobe.cairngorm.control::CairngormEventDispatcher/dispatchEvent()
> at component.form::LoginForm/::login()
> at component.form::LoginForm/::validateMe()
> at component.form::LoginForm/__loginButton_click()
>