These are the basic steps for creating the service:
1. Code the service endpoint interface and implementation class.
A service endpoint interface must conform to a few rules: • It extends the java.rmi.Remote interface. • It must not have constant declarations, such as public final static. • The methods must throw the java.rmi.RemoteException or one of its subclasses. (The methods may also throw service-specific exceptions.) • Method parameters and return types must be supported JAX-RPC types. See the section Types Supported By JAX-RPC (page 456). In this example, the service endpoint interface is HelloIF.java: package helloservice; import java.rmi.Remote; import java.rmi.RemoteException; public interface HelloIF extends Remote { public String sayHello(String s) throws RemoteException; }
In addition to the interface, you’ll need the class that implements the interface. In this example, the implementation class is called HelloImpl: package helloservice; public class HelloImpl implements HelloIF { public String message =“Hello“; public String sayHello(String s) { return message + s; } }
2. Build, generate, and package the files required by the service.
The process includes below steps:
• compile-service
• generate-sei-service
• package-service
• process-war
3. Deploy the WAR filethat contains the service.
本文介绍了创建远程服务的三个主要步骤:编码服务端点接口及其实现类;构建、生成及打包服务所需文件;部署包含服务的WAR文件。此外还详细说明了服务端点接口必须遵循的规则。
1万+

被折叠的 条评论
为什么被折叠?



