Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1] 2
Print
Author Topic: Weborb Login Sample using AMFPHP instead  (Read 10885 times)
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« on: September 09, 2008, 12:46:03 »

Hi everyone, i really need some help figuring out why i am getting an error with my app. i am trying to rebuild the Login weborb sample, but this time using AMFPHP. all the logic for the remote object has been set up for working with AMFPHP. But when i try to log in, i get this error

Argument 1 passed to LoginService::getUser() must be an instance of LoginVO, array given

its driving me nuts, because a LoginVO type is what is sent to the _loginService remoteobject when the getUser is called

public function getUser( vo : LoginVO ):void
{
   _loginService.getUser( vo );  <-- HERE   
   CursorManager.setBusyCursor();
}

but i still get the above error ???

i am also suspecting that my php VO and my actionscript VO paths dont match. cant this really be a problem?

my login service has a source of

_loginService.source = "BuiPower.LoginService";

within my Services folder, i have the BuiPower folder then the LoginService.php file. it looks like this (i have removed code so this post isnt too chunky)

<?php

class LoginService
{
   public function __construct()
   {
      //code to connect to db etc
   }
   
   function getUser(LoginVO $loginVO)
   {
      include_once("../vo/net/scriptoninteractive/flex/weborb/buipower/model/vo/LoginVO.php");

    ....(more code to authenticate credentials)
    }
}

?>

finally my actionscript VO and php VO look like this

package net.scriptoninteractive.flex.weborb.buipower.model.vo
{
   [RemoteClass(alias="BuiPower.LoginVO")]   <--notice as VO path isnt same as php
      [Bindable]
   public class LoginVO
   {
      public var username: String;
      public var password: String;
      public var loginDate: Date;
   }   
}
and the php VO which is located in the services folder as
vo/net/scriptoninteractive/flex/weborb/buipower/model/vo/LoginVO.php is

<?php
class LoginVO
{
   var $username;
      var $password;
   var $loginDate;
   
   //explicit actionscript package
   var $_explicitType = "net.scriptoninteractive.flex.weborb.buipower.model.vo.LoginVO";
}
?>

does anyone have any idea...or can share how they have done it with AMFPHP. thanks a bunch!

Sincerely,
Kofi Addaquay
Logged
danielcsgomes
Full Member
***
Posts: 47

 - daniel@onedesign.com.pt
View Profile Email
« Reply #1 on: September 09, 2008, 01:14:21 »

Hi kofi,

The problem is server side, where do you have your LoginVO in amfphp? what directory? it may depend on your amfphp configurations.

Daniel Gomes
Logged
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« Reply #2 on: September 09, 2008, 08:50:10 »

Thanks for your reply Daniel...

the LoginVO is located in my Services folder under the "vo" folder...like this

Services -> vo -> net -> scriptoninteractive -> flex -> weborb -> buipower -> model -> vo -> LoginVO.php
Logged
danielcsgomes
Full Member
***
Posts: 47

 - daniel@onedesign.com.pt
View Profile Email
« Reply #3 on: September 09, 2008, 09:01:25 »

Try this on LoginVO.as:


package net.scriptoninteractive.flex.weborb.buipower.model.vo
{
   [RemoteClass(alias="net.scriptoninteractive.flex.weborb.buipower.model.vo.LoginVO")]   
      [Bindable]
   public class LoginVO
   {
      public var username: String;
      public var password: String;
      public var loginDate: Date;
   }   
}

The paths must be exactly in server side and client side.

Daniel Gomes
Logged
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« Reply #4 on: September 09, 2008, 09:22:40 »

thats what i thought too...but every time i have my LoginVO like this..

package net.scriptoninteractive.flex.weborb.buipower.model.vo
{
   [RemoteClass(alias="net.scriptoninteractive.flex.weborb.buipower.model.vo.LoginVO")]   
      [Bindable]
   public class LoginVO
   {
      public var username: String;
      public var password: String;
      public var loginDate: Date;
   }   
}

my php loginVO looks like this

<?php
class LoginVO
{
   var $username;
      var $password;
   var $loginDate;
   
   //explicit actionscript package
   var $_explicitType = "net.scriptoninteractive.flex.weborb.buipower.model.vo.LoginVO";   
}
?>



and then i change my remoteobject from

_loginService.source = "BuiPower.LoginService";

to this

_loginService.source = "net.scriptoninteractive.flex.weborb.buipower.LoginService";

I now get this error:

"Channel Disconnected"

and this happened when i noticed that the paths are supposed to be the same. my attempt to do has brought me to this error. do you know what this is Daniel?

Thanks
Logged
danielcsgomes
Full Member
***
Posts: 47

 - daniel@onedesign.com.pt
View Profile Email
« Reply #5 on: September 09, 2008, 09:28:36 »

where is your LoginService.php file? what directory?

if you have LoginService in services/LoginService.php

your source was to be like this: _loginService.source = "LoginService";

But when i use PureMVC i always use the same directory structure on both (server side and client side).

Use the Service Capture and see what happen.

And make sure that all paths are correctly.

Daniel Gomes
Logged
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« Reply #6 on: September 09, 2008, 09:40:27 »

my LoginService.php is located here:

Services -> net -> scriptoninteractive -> flex -> weborb -> buipower -> LoginService.php

thats why i have it like this

_loginService.source = "net.scriptoninteractive.flex.weborb.buipower.LoginService";

so that should work right?

what is service capture?
Logged
danielcsgomes
Full Member
***
Posts: 47

 - daniel@onedesign.com.pt
View Profile Email
« Reply #7 on: September 09, 2008, 09:43:27 »

Service Capture is a software to see what happens when you call web services you can download the trial here:

http://kevinlangdon.com/serviceCapture/

Probably it's working but maybe it's something wrong in your database connection or authenticate credentials and you only see it if you use Service Capture i think. Channel Disconnect can be a lot of tip of errors.

Daniel Gomes
Logged
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« Reply #8 on: September 09, 2008, 12:33:11 »

Have you ever seen this with servicecapture

correlationId (String):
faultCode (String): AMFPHP_FILE_NOT_FOUND
faultDetail (String): /Users/kofiaddaquay/Sites/amfphp2/core/shared/app/BasicActions.php on line 33
faultString (String): The class {Amf3Broker} could not be found under the class path {/Users/kofiaddaquay/Sites/amfphp2/services/amfphp/Amf3Broker.php}

file not found? i dont understand. everything is in the right position :(
Logged
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« Reply #9 on: September 09, 2008, 12:43:16 »

weird thing is that when i take the contents of the vo folder located in services and put it in the services root, it takes me back to the error

Argument 1 passed to LoginService::getUser() must be an instance of LoginVO, array given


instead of

vo/net/scriptoninteractive/flex/weborb/buipower/model/vo/LoginVO.php

i have

net/scriptoninteractive/flex/weborb/buipower/model/vo/LoginVO.php

then i get the above error. but amfphp requires you have it in the vo folder :(
Logged
danielcsgomes
Full Member
***
Posts: 47

 - daniel@onedesign.com.pt
View Profile Email
« Reply #10 on: September 09, 2008, 01:28:38 »

Take a look in LoginService

function getUser(LoginVO $loginVO)
   {
      include_once("../vo/net/scriptoninteractive/flex/weborb/buipower/model/vo/LoginVO.php"); <-------------- This path is totally correct?

    ....(more code to authenticate credentials)
    }


try change it to: "../../../../../../vo/net/scriptoninteractive/flex/weborb/buipower/model/vo/LoginVO.php"

Daniel Gomes
Logged
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« Reply #11 on: September 09, 2008, 09:44:23 »

well..every since you said you keep your services in the root of the services folder...i have now put the loginservice.php in that directory. the reverse domain syntax was also too long i cut it down. so the function looks like

function getUser(LoginVO $loginVO)
   {
      include_once("vo/net/scriptoninteractive/buipower/model/vo/LoginVO.php");

    ....(more code to authenticate credentials)
    }

but why ../../../../../../vo/net/scriptoninteractive/flex/weborb/buipower/model/vo/LoginVO.php? isnt that going too far back in the folder directory? i will try it anyway!
Logged
danielcsgomes
Full Member
***
Posts: 47

 - daniel@onedesign.com.pt
View Profile Email
« Reply #12 on: September 10, 2008, 01:48:11 »

well..every since you said you keep your services in the root of the services folder

My english is a little bad, but i think i never said that, because i always use the same file/directory structure in client side and server side, soo that's way i told you to return back in folder directory, but if you have it in your root Services it should work with ../vo/net/scriptoninteractive/flex/weborb/buipower/model/vo/LoginVO.php. But my advice is to use the same structure of PureMVC. The problem here is some path's that are incorrect or a little bug, use the amfphp browser and see if it's working (i'm talking about the LoginService).

Daniel Gomes
Logged
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« Reply #13 on: September 10, 2008, 11:20:11 »

Hi :)

thats another problem i am having. in the service browser you are asked for loginVO...what parameter do i put in? username and password are 2 params and not one. is there a way to format username and password into one string to test the service? like some kind of object..get what i mean?
Logged
kofiaddaquay
Full Member
***
Posts: 31


View Profile Email
« Reply #14 on: September 10, 2008, 11:48:03 »

so, i make a call to the service using this json string

"[{username: 'kofi', password: 'kofi', loginDate:'test'}]"

and i get this

(Object)#0
  message = "faultCode:AMFPHP_RUNTIME_ERROR faultString:'Argument 1 passed to LoginServiceFacade::getUser() must be an instance of LoginVO, string given' faultDetail:'/Users/kofiaddaquay/Sites/amfphp2/services/LoginServiceFacade.php on line 26'"
  name = "Error"
  rootCause = (null)

one thing is for sure. the LoginVO class cannot be seen. why? i dont know
Logged
Pages: [1] 2
Print