Can't find a service?

30 views
Skip to first unread message

Jamie Jackson

unread,
May 11, 2012, 11:14:39 AM5/11/12
to framew...@googlegroups.com
In a controller function, I've got this call:
variables.fw.service( "nameservice.save", "data" );

I intend for this to correspond to services/nameservice.cfc, "save" method.

However, I'm getting:
Detail To have the execution of this service be conditional based upon its existence, pass in a third parameter of 'false'.
Message Service 'nameservice.save' does not exist.

What am I doing wrong?

Thanks,
Jamie

Dutch Rapley

unread,
May 11, 2012, 12:30:51 PM5/11/12
to framew...@googlegroups.com
try variables.fw.service("name.save", "data");

"service" is not needed when specifying the name of the service - that's part of the convention used in FW/1.

--
FW/1 on RIAForge: http://fw1.riaforge.org/
 
FW/1 on github: http://github.com/seancorfield/fw1
 
FW/1 on Google Groups: http://groups.google.com/group/framework-one

Jamie Jackson

unread,
May 14, 2012, 12:53:17 PM5/14/12
to framew...@googlegroups.com
Okay, thanks for that.

Here's what I've got going on now:

Controller:
variables.fw.service( "name.saveFirstName", "data" );

Then, in the service (which no longer causes the above line to throw an error), I've got a saveFirstName function, which has a dump in it. I can't get that method to get called. It's like FW/1 isn't calling it, but it's not throwing an error, either.

I also put in an onMissingMethod() with a dump in that, as well, just to see if I had some function naming problem. No dice there, either.

Any ideas?

Thanks,
Jamie

Sean Corfield

unread,
May 14, 2012, 12:57:46 PM5/14/12
to framew...@googlegroups.com
On Mon, May 14, 2012 at 9:53 AM, Jamie Jackson <jamie...@gmail.com> wrote:
> Then, in the service (which no longer causes the above line to throw an
> error), I've got a saveFirstName function, which has a dump in it. I can't
> get that method to get called. It's like FW/1 isn't calling it, but it's not
> throwing an error, either.

Services can't output anything so unless you have an abort after the
dump (to stop the request and show debug output) you won't see it.

Also bear in mind fw.service() _queues_ the call, it doesn't happen
until the controller method is finished.
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

Jamie Jackson

unread,
May 14, 2012, 1:08:59 PM5/14/12
to framew...@googlegroups.com
On Mon, May 14, 2012 at 12:57 PM, Sean Corfield <seanco...@gmail.com> wrote:
On Mon, May 14, 2012 at 9:53 AM, Jamie Jackson <jamie...@gmail.com> wrote:
> Then, in the service (which no longer causes the above line to throw an
> error), I've got a saveFirstName function, which has a dump in it. I can't
> get that method to get called. It's like FW/1 isn't calling it, but it's not
> throwing an error, either.

Services can't output anything so unless you have an abort after the
dump (to stop the request and show debug output) you won't see it.

Thanks, Sean. I do have an abort immediately after the dump:
 
Also bear in mind fw.service() _queues_ the call, it doesn't happen
until the controller method is finished.

Hmm, does that mean that I can't base some branching off of the result of the service call in the same controller that called it? If so, what's the right/alternate way to do the following? (See highlighted lines.)

 
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

Joe Brislin

unread,
May 14, 2012, 1:27:12 PM5/14/12
to framew...@googlegroups.com
If you are queuing up service methods utilizing the framework, then you cannot run conditional statements within the same controller method. You would need to run your service calls in your startItem controller method and then run conditional statements in your endItem method. Most people now are opting to not use implicit service calls managed by the framework. Instead they are choosing to either manage their own bean factory or utilize a DI framework such as ColdSpring or DI/1.

-- 
Joe Brislin

Jamie Jackson

unread,
May 14, 2012, 1:32:37 PM5/14/12
to framew...@googlegroups.com
Okay, I understand, thanks. ColdSpring was the next step, anyway, so I'll get on that now.

--
Reply all
Reply to author
Forward
0 new messages