简体   繁体   中英

interface-based Java/Groovy web services

In my experience, most distributed object technologies (RMI, CORBA, etc.) work something like this:

  • define a service interface
  • write an implementation of the interface
  • use a tool (rmic, IDL compiler, etc.) that generates code which enables a client to get a reference to an implementation of the interface given some endpoint (URL).

The important point is that the service interface is a shared contract that both the client and service must adhere to. I've had a look at metro , and it doesn't seem to follow this pattern.

I'm looking for alternative suggestions that do support this kind of interface-based web service development. Unfortunately, I'm required to use SOAP, so libraries that only support RESTful services are no good to me.

Ideally, I would like to follow a code-first, rather than a contract-first appeoach, ie I define the (Java) service interface and the WSDL is generated from that, rather than the other way around.

Solutions that support defining or implementing the service using Groovy (instead of Java) are particularly welcome.

Metro allows you to annotate a given method, put a hint or two about the endpoints in the servlet container configuration files, and then have the WSDL generated automatically on request.

This is very nice, and save you all the trouble of having to create a full WSDL for just exposing a method or two.

Metro is good (+1), but Apache CXF 's Simple Frontend goes one step further: you don't have to annotate anything. It generates WSDLs, clients and servers from plain Java interfaces.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM