Overview |
Required Software
Getting HTTPRemoting The easiest way to get the latest released sources is from the download site. To get the latest sources from cvs, provide this information to your cvs-client :
Then checkout module httpremoting. Installation You just need to extract the downloaded module. Build from the source If you want to build the project from the sources you need to have Jakarta ANT 1.5+, then you just need to run "ant build", it'll build the project and put the distribution(httpremoting.jar) on <httpremoting-home>/build/dist folder. Start using HTTPRemoting with a simple sample Let's try HTTPRemoting by a simple sample, 1. Put <httpremoting-home>/lib/*.jar and <httpremoting-home>/build/dist/httpremoting.jar in your Classpath 2. Define interface of your services, We call it EchoService as follows: public interface EchoService { All service methods need to throw "org.art.remoting.invocation.RemotingException" 3. Implement the service: public class EchoServiceImpl implements
EchoService{ 4. Define the service in a file named remoting-services.xml : <?xml version="1.0" ?> each service needs to be defined here to be remotable by the HTTPRemoting framework. Note: Make sure to put remoting-services.xml in your classpath. 5. HTTPRemoting framework can be easily run and tested via Jetty Open Source Servlet container, Although it can run on every Servlet 2.x compliant J2EE Servlet Container. For starting Jetty Web Container and testing the framework run the following command in a separate console window: java org.art.remoting.transport.http.server.JettyWebContainer <port> by default it uses port 80 but you can specify another port by passing the port number to the program. 6. Now the Web Container is started , your service has been deployed and is ready to accept invocations, let's write a test client: public class EchoServiceTestClient { put httpremoting.jar and EchoService.class in the classpath and run the following command in a separate console window: java EchoServiceTestClient It should work!
|
|