For integration with a legacy app, I have a need to call some of my custom services (built in the extension environment) from an external Java application (running on a remote machine).
I'm trying to get a handle on the best way to do this, what code is ALREADY built into Liferay and the ServiceBuilder system, what needs to be done manually, etc. I'm willing to write some docs and put it in the Wiki if someone from the Liferay team (or some better informed community members) can point me in the right direction...
First, I don't want to use EJB - I'm deploying my portal in a Tomcat environment. SOAP is an option, as is the custom Tunneling. Hessian or Burlap would be fine also. I'm most familiar with Spring Remoting (in particular, their Http remoting system), but I don't think Liferay supports it (at the moment). While I certainly can get it working with Spring, I'm looking for the "easy" solution which I think already exists.
I'm using the extension environment, and have created a custom entity (let's say its MyEntity). The code I want to call is in
MyEntityServiceImpl.javaI'm trying to get a handle on exactly what some of the pre-generated code does: in particular,
MyEntityServiceHttp.java and
MyEntityServiceSoap.javaI've been studying the code, and here is what I know (and don't know). Can anyone help confirm or deny these assumptions:
1) MyEntityServiceHttp.java is a stub that the CLIENT APP can call to use the Tunneling Servlet to call into MyEntityServiceImpl server side. I have written a small test app (using what little
info I found in the Wiki regarding remoting). This seems to work, but has a somewhat surprising set of dependencies for my client app. In order for stand-alone client app to call my service, I need the following .jar files available in my classpath:
1
2/ext/ext-ejb/ext-ejb.jar
3/ext/ext-service/ext-service.jar
4
5/portal/portal-ejb/portal-ejb.jar
6/portal/portal-kernel/portal-kernel.jar
7/portal/util-java/util-java.jar
8/portal/lib/portal/concurrent.jar
9/portal/lib/portal/commons-logging.jar
10/portal/lib/portal/log4j.jar"
11/portal/lib/portal/dom4j.jar
12/portal/lib/development/servlet.jar
13/portal/lib/portal/easyconf.jar
14/portal/lib/portal/commons-lang.jar
15/portal/lib/portal/commons-digester.jar
16/portal/lib/portal/commons-configuration.jar
17/portal/lib/portal/xstream.jar
18/portal/lib/portal/commons-collections.jar
19/portal/lib/portal/commons-beanutils.jar
20/portal/lib/portal/jcr.jar
21/portal/lib/portal/velocity.jar
22/portal/portal-service/portal-service.jar
WOW! That's a lot of library code just to make a remote call. It appears to include most of the code required to run the portal in the first place! I was particularly suspicious of the need to include Velocity (what does Velocity have to do w/ tunneling). I think it is perhaps because there are so many dependencies in the initialization phases of most of the utility methods, it includes about everything. It was this huge list that leads me to believe that perhaps Tunneling is not intended for use by a stand alone J2SE Java app, and is instead perhaps best for portal to portal calls.
So, now I'm thinking perhaps "SOAP" is the answer:
2) From my (somewhat limited) study of the code, it appears that MyEntityServiceSoap.java is some code that resides SERVER SIDE that accepts the incomming call from a SOAP call and dispatches to MyEntityServiceImpl. Is there any generated client side code I can use?
I've found the
portal-client.jar in the source tree. It apperas to contain all the CLIENT SIDE code for connecting to the SERVER SIDE xxServiceSoap.java facades. Is this code generated? How is it generated? Simply by running the
build-client target in the
/portal/portal-client/build.xml Ant file? Is there similar such automatic generation (Ant files or otherwise) for the Extension Environment? Do I instead need to generate my own WSDL? Is there some URL I can call on my running Liferay instance that will generate the WSDL?
Finally - I've heard Hesian and Burlap mentioned in the docs, but have found NOTHING about actually using them in the docs, the forums, the Wiki, etc.
Any tips would be appreciated! I'll take the knowledge gathered here and put it in the Wiki.