Git Product home page Git Product logo

ejbclientdemo's Introduction

EJB多语言客户端演示

EJB发布为Restful Web Service

EJB3Stateless Session Bean可以同时支持RMI-IIOPWeb Service等多种远程调用方式,只要Bean同时实现多种接口:

  • 业务接口
public interface BusinessService {

    public Response createOrder(String userId, String commodityCode, int count);

    public List<String> getUserList(String start, String end);
}

  • Remote接口
@Remote
public interface BusinessServiceRemote extends BusinessService {
}
  • LocalRestful Web Service接口
@Local
@Path("business")
public interface BusinessServiceLocal extends BusinessService {

    @POST
    @Path("/createOrder")
    @Produces("application/json")
    @Override
    public Response createOrder(@FormParam("userId") String userId,
                                @FormParam("commodityCode") String commodityCode,
                                @FormParam("count") int count);

    @GET
    @Path("/getUserList")
    @Produces("application/json")
    @Override
    public List<String> getUserList(@QueryParam("start") String start,
                                    @QueryParam("end") String end);
}
  • Bean同时实现多种接口
@Stateless
public class BusinessServiceBean implements BusinessService,
        BusinessServiceLocal, BusinessServiceRemote, Serializable {
...

C++ REST客户端

cpprestsdk 是微软开源的 C++ REST SDK,使用了现代异步C ++ API设计,帮助C ++的开发人员与Web Services进行连接和交互。

本示例使用了cpprestsdk,演示了POSTGET两种HTTP method访问EJB暴露的Web Services

Python REST客户端

Requests 是Python的第三方库,让处理HTTP请求变得非常简单。

本示例使用了Requests访问EJB暴露的Web Services

Java客户端

Java客户端运行在Application Client Container (ACC)中。ACC使用RMI-IIOP协议与应用服务器通信。

Java客户端business-client打包在 business-ear 中部署到应用服务器,使用asadmin get-client-stubs命令获得Client Stubs

./asadmin get-client-stubs --appname business-ear .

运行Java客户端:

./appclient -client business-earClient.jar -targetserver localhost:3700  [userId] [commodityCode] [count]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.