0 Replies Latest reply on Dec 7, 2006 6:52 AM by dankokozar

    Problems with Flex consuming two different web services

    dankokozar
      Hi everyone,
      here's my problem:

      I have two different web services (two different URLs and WSDLs) which are hosted by ASP.NET.
      The first one is used only for loging in, and the second one is accessible by authenticated users only.

      Their declarations are:
      quote:

      <mx:WebService id="publicWebService"
      wsdl="{publicWebServiceUrl}"
      showBusyCursor="true">
      <mx:operation name="Login" result="loginResponseHandler(event)" fault="webServiceFaultHandler(event)" />
      </mx:WebService>

      <mx:WebService id="protectedWebService"
      wsdl="{protectedWebServiceUrl}"
      showBusyCursor="true">
      <mx:operation name="HelloWorld2" result="protectedWSResponseHandler(event)" fault="webServiceFaultHandler(event)" />
      </mx:WebService>


      By the way, publicWebServiceUrl and protectedWebServiceUrl are variables filled with URLs

      Here is the result event from calling the first WS:
      quote:

      // publicWebService calls this handler after loading resource collection
      private function loginResponseHandler(event:ResultEvent):void {

      var res:LoginResponse = new LoginResponse(event.result);

      if (res.Success){
      mx.controls.Alert.show('Login successfull!', 'Info');
      // connect to a protected web service
      protectedWebService.loadWSDL(protectedWebServiceUrl);
      // test it
      protectedWebService.HelloWorld2();

      } else {
      mx.controls.Alert.show('Login not successfull!', 'Info');
      }
      }


      The problem is that a call to a second WS raises the error: the method "HelloWorld2" seems to not exist!
      I doublechecked everything and cannot find out why.
      Seting the breakpoint just after the "protectedWebService.HelloWorld2();" I've seen that protectedWebService object has methods of both publicWebService and protectedWebService (???), and it deffinitely HAS a "HelloWorld2" method.

      Thanks in advance!!