Announcement Announcement Module
Collapse
No announcement yet.
HttpInvokerServiceExporter interfaces Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HttpInvokerServiceExporter interfaces

    A new requirement has come along and I will need to expose some of our applications services to external parties. Not an issue using Spring. I have lot's of choices. (I'm going to tread down the path of the simple HTTP exporter to begin with) The problem I have is that a good portion of my domain objects have adjacent domain objects (parent-child) in which the children are lazy loaded. This of course will not work when serializing the domain object over the wire. So I've been trying to implement a separate domain model; one for the existing application and one that will be distributed to the clients.

    The challenge that I have now is not only will I need to support two separate domain models and the mappings but I find myself stuck on implementing two service interfaces and two service implementations. (One as a Proxy and the other as the delegate)

    I've been looking through the HttpInvokerServiceExporter and I thought I had a few things figured that I could tell the exporter the interface that is to be exported (Client interface) and give the exported a reference to the implementation (existing). While the interfaces are not compatible I thought that I might be able to implement a RemoteInvocationExecutor that would be able to recieve the method invocation request, map the client argument objects to the existing domain model objects, invoke the service with the new arguments, map the result object into the client domain object(s) and return. The problem that I ran into was the fact that in the RemoteExporter class the method checkServiceInterface() tests to ensure that the interface being exported is supported by the service and raises an exception.

    To get past that I extended HttpInvokerServiceExporter and overrided the checkServiceInterface method to avoid the exception which it did and I got past this problem. However when my RemoteInvocationExecutor was invoked and it called invocation.invoke() I received the following exception:

    Code:
    java.lang.IllegalArgumentException: object is not an instance of declaring class.
    So my question is this; Can I utilize AOP that will generate a DynamicProxy that will implement my client service interface that I can intercept all method calls, swap out the arguments with the correct datatype and continue invocation?

    Any samples would be greatly appreciated.
    Thanks...
Working...
X