0

I'm trying to expose a remote interface to a spring web application, and I'm having issues, always getting 404. What's wrong with my setup below?

Grails:
services - package mypackage

class RemoteUserService implements RemoteUserServiceInterface {
    static expose = ['httpinvoker']

    User findUser(String userId) {
        return User.findByUserId(userId);
    }
}

src/groovy/mypackage

class RemoteUserService implements RemoteUserServiceInterface {
    static expose = ['httpinvoker']

    User findUser(String userId) {
        return User.findByUserId(userId);
    }
}

Spring:
mypackage

public class MyController extends AbstractController {
    RemoteUserServiceInterface remoteUserService
}

appContext

<bean id="viewController" class="mypackage.MyController">
    <property name="remoteUserService" ref="remoteUserService"/>
</bean>

<bean id="remoteUserService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    <property name="serviceUrl" value="http://localhost:8080/grails-app-name/httpinvoker/RemoteUserService"/>
    <property name="serviceInterface" value="mypackage.RemoteUserServiceInterface"/>
</bean>
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
  • (1) In your problem description, I believe you copy/pasted your service code where you should have copy/pasted your interface code. (2) Do you get a 404 error when going to 'http://localhost:8080/grails-app-name/httpinvoker/RemoteUserService' via your browser? Or is this just a problem when connecting using your remote MyController? – Derek Slife Apr 09 '11 at 19:28
  • I get a 404 if I go to this directly in the browser. The interface just defines the single method available in the service. – Stefan Kendall Apr 11 '11 at 13:18

1 Answers1

0

You need to define a UrlMapping of

"$controller/$action?/$id?" {}

or else the plugin won't work correctly.

Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406