Flex value object has null properties in java.
I have a simple service I have created using Spring-Flex 1.5. When I pass data from flex to java the value object is null on the java end. I have tested and debugged as much as I possibly could and I find not find a reason for this.
I have tried to narrow the possibilities down as much as I could. So instead of doing anything with my data, I simply just return the passed in value object.
I have verified that I am able to hit the service and the service does return data by creating the test(String dataString) method in my service. This method does return the correct result.
This is the data that I am sending to java:
(UserAccount)#0
InstanceID = 1
IsLoggedIn = false
IsVisible = false
UserID = NaN
UserName = "user123"
UserPass = "password"
UserStatus = true
UserTypeID = 1
This is what I am receiving back:
(UserAccount)#0
InstanceID = NaN
IsLoggedIn = false
IsVisible = false
UserID = NaN
UserName = (null)
UserPass = (null)
UserStatus = false
UserTypeID = NaN
log4j log file:
Code:
723011 ["http-bio-8080"-exec-28] DEBUG com.rottmanj.services.user.UserAccountService - com.rottmanj.domain.user.UserAccount@5994a1e9
.
Actionscript code:
Code:
<fx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;
private function sendVO():void
{
var vo:UserAccount = new UserAccount();
vo.UserName = 'user123';
vo.UserPass = 'password';
vo.UserStatus = true;
vo.IsLoggedIn = false;
vo.IsVisible = false;
vo.UserTypeID = 1;
vo.InstanceID = 1;
dBug.text = ObjectUtil.toString(vo);
ro.save(vo);
}
private function resultHandler(event:ResultEvent):void
{
dBug.text = dBug.text + ObjectUtil.toString(event.result);
}
private function faultHandler(event:FaultEvent):void
{
dBug.text = dBug.text + ObjectUtil.toString(event.fault);
}
]]>
</fx:Script>
Actionscript VO:
Code:
[Bindable]
[RemoteClass(alias="com.rottmanj.domain.user.UserAccount")]
public class UserAccount
{ (setters/getters)...}
Java Service:
Code:
@Service
@RemotingDestination
public class UserAccountService {
private UserAccountDAO dao = null;
private static Logger logger = Logger.getLogger(UserAccountService.class);
@Autowired
public void setDao(UserAccountDAO dao)
{
this.dao = dao;
}
@RemotingInclude
public UserAccount save(UserAccount dataObject)
{
logger.debug(dataObject.toString());
return dataObject;
}
@RemotingInclude
public String test(String dataString)
{
logger.debug(dataString.toString());
return "This is a Test for " + dataString;
}
}