[coldbox 4.2.0] - populating a model from a remote web service

Im currently trying to implement a call to a remote web service which returns a SOAP package. I have the web service call working and returning data. I have defined a model for the data coming back from the web service.

I now want to populate my model with the data from the web service. I assumed populateFromStruct would do the trick, but I just get an empty object. Can someone point me in the right direction. Here is what Im doing now:

var userData = getWebService().getUserByUserId(arguments.userid);

local.userObj = populator.POPULATEFROMSTRUCT( wirebox.getInstance(“TestUserBean”), UserData);


Hi Robert,

Try to add accessors=true in your TestUserBean, this might resolve your issue :slight_smile:

component output=“false” accessors=“true”{

Tried using accessors=“true” as you suggested. Still not populating the model. Any other suggestions?


Is the previous dump of the data the exact value of the UserData variable? If so, should it be UserData.data.user?

If I were you I’d just step through the code in the object populator and see what’s happening.



Yes it is. I tried userData.data.User and I get the following error:

can’t cast Object type [mhtz5rgxki09.WEB_INF.lucee.components.realauction.realtda.User180] to a value of type [struct]

Then debug whether or not you’re passing in a struct.



ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Its a struct, but within the struct the SOAP web service is returning a bean