Spring: How to return a httpinvoker-proxy class by a httpinvokerservice

225 Views Asked by At

I have a small application server (tomcat) with spring and a HttpInvokationServiceExporter.

This classes are on Server:

public interface IAccount{
    public IUser getUser();
}

public class Account implements IAccount{
    private IUser user; 

    public Account(IUser user){
        this.user = user
    } 

    @Override 
    public IUser getUser(){return this.user}
}

public interface IUser{
    public String getName();
}

public class User implements IUser(){
    private String name;

    public User(String name){
        this.name = name;
    }

    @Override
    public String getName(){ return this.name) }
}

My HttpInvokerService Exporter exports an instance of the Account-class to the clients with IAccount as the service-interface, so far so good.

If I now try to invoke the method getUser() at client-side the client tries to deserialize the returned object to a User-Object and throws an exception because it does not know the class User.

But I want it to be like a proxy you get from the HttpInvokerServiceExporter in order to invoke the methods from the User-class on the server with IUser as a service-interface instead of deserialzing the result to the User-class. The client should only know the interfaces and and no implementations of these.

I hope you can understand my problem, if you need to see my applicationContext.xml on server- and client-side or web.xml feel free to ask for it:)

P.s.: Also feel free to edit the title because I hardly could describe my problem in a few words

0

There are 0 best solutions below