View Full Version : Using Burlap or Hessian Remote tag
NickJ
Feb 22nd, 2006, 10:36 AM
My apologies if this is a FAQ, or in another thread, I did spend some considerable time trying to find the answer to my question. That said, my question is: "Does Spring support the serialization of an object (proxy?) into a Burlap or Hessian "Remote" tag?"
I am trying to use this by setting up a service proxy on my client, then passing that service proxy to the server to perform a callback. At the moment all that happens is that the service proxy gets serialized as an object of type $proxy1, which the server side cannot understand.
I would like to see the client side proxy serialized into a "Remote" tag, which is then deserialized at the server side into the appropriate (newly generated?)proxy.
FYI This is what the Forte (Sun UDS) world refers to as an "anchored object".
TIA,
Nick James.
jbalint
Feb 22nd, 2006, 10:53 AM
Hi Nick -
I don't think what you are trying to do is possible the way you want to. The thing is that Hessian/Burlap services have to be explicitely exposed via HTTP. If you create an arbitrary service object in the JVM, nothing external to the JVM can access it unless you expose it as a service via HTTP. You might be able to make a callback service and have something similar to the JMS correlation id so that a remote client can call into the callback service with the id of the callback object (that must have previously registered with it). Hope this helps.
Jess
NickJ
Feb 22nd, 2006, 11:06 AM
Thanks for the quick reply.
I am exposing my client side service using Burlap and the HTTPServlet mechanism. What I want is to create a remote object for this URL with parameters and stuff to send as an argument to a remote call, so that the remote Spring service can make the callback on this local service (through the URL).
Nick.
jbalint
Feb 22nd, 2006, 11:15 AM
Ok, I see. So how are you setting up the proxy that you are serializing? Are you just creating a burlap client proxy where the service resides and sending that across? Have you setup the service interface? Does the remote side have a copy of that service interface? Have you tried casting it on the remote side?
Some details at how you are arriving at your conclusions would also help.
Jess
NickJ
Feb 22nd, 2006, 11:43 AM
For a simple Junit test I created an RMI proxy to send to my Burlap service, as a parameter. See the following spring.xml snippet:
<bean id="remoteBean"
class="org.springframework.remoting.rmi.RmiProxyFactoryBe an"
depends-on="remoteBeanExport">
<property name="serviceUrl"
value="rmi://localhost:1099/scriptService" />
<property name="serviceInterface"
value="com.carlson.cwt.script.ScriptService" />
</bean>
<bean id="remoteBeanExport" class="org.springframework.remoting.rmi.RmiServiceExporte r">
<property name="registryHost" value="localhost"></property>
<property name="registryPort" value="1099"></property>
<property name="serviceName" value="scriptService"/>
<property name="serviceInterface" value="com.carlson.cwt.script.ScriptService"/>
<property name="service" ref="localScriptService"/>
</bean>
<bean id="burlapScriptService" class="org.springframework.remoting.caucho.BurlapProxyFac toryBean">
<property name="serviceUrl" value="http://localhost:8100/harmony/burlap.script.service"/>
<property name="serviceInterface" value="com.carlson.cwt.script.ScriptService"/>
</bean>
My test method is:
public void testBurlapPingRemoteObject() {
try {
ApplicationContext lContext = getContext(getConfigLocations()[0]);
Object lBean = lContext.getBean("remoteBean");
getBurlapScriptService().pingRemoteObject(lBean);
} catch (Exception e) {
fail("Unexpected Exception encountered - " + e);
}
}
My service interface is:
package com.carlson.cwt.script;
public interface ScriptService {
String ping(String lString);
String pingRemoteObject(ScriptService pBean);
}
My implementation of pingRemoteObject is to call the ping method on the provided ScriptService object. Kind of eating its own dog food!
I hope I have provided enough information to help understanding the problem. When I run under the Eclipse debugger, I see the proxy arrive in Burlap as the serialised proxy, not as a "remote" tag.
I am also assuming that an RMI proxy is good enough to demonstrate the problem in a simple Junit test.
Thanks,
Nick.
jbalint
Feb 22nd, 2006, 11:50 AM
I'm not sure what you mean by "remote tag", but it seems like your are on the right track.
Does this code throw an exception when you run it? I think the serialized proxy is actually what you want on the remote side. That should be what is needed to make the call.
It looks like you are passing the actual RMI client proxy? I was under the impression that you would be passing the Burlap client proxy....
Jess
NickJ
Feb 22nd, 2006, 12:00 PM
In the actual application it is Burlap on both sides. For my Junit test, I "assumed" that an RMI client proxy would be a more convenient exporter, because of the infrastructure is already there in the JVM. I must admit that I have no evidence (yet) that the RMI proxy is callable from the remote side.
It looks to me like Spring creates a Proxy class out of thin air (or cglib) and serializes that object as is. When it arrives at my Burlap service it expects an object of type "ScriptService" not "$Proxy1" and so throws a BurlapProtocolException. What I would really like is for Spring to recognise that my RMI proxy cannot exist outside of my local JVM and create a remote tag in the Burlap.
On the remote side I would like Burlap to create a proxy on the fly for the remote tag to proxy a remote object of type "ScriptService".
Burlap alludes to using the remote tag for an EJB implementation. Does anyone know if Spring will generate a remote tag in Burlap to serialize an EJB?
Nick.
rajakar
May 6th, 2012, 04:27 AM
Thanks dude.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.