The right tool for simple XML interfaces

I need to expose some web application services for remote clients via XML interfaces via http. The range of services provided is limited (3-7), and the request and response should be simple and do not require any special data types or relations between entities.

My goal is to keep the code clean and understandable and have a reliable and efficient application. I would really appreciate your advice on the proper XML \ processing binding tool to be used for this task.

UPD: Bad, they did not mention that a restlet is required for implementation, however, since I'm interested, it does not impose any restrictions on the xml tool used.

Thanks in advance.

+6
source share
5 answers

The JAX-RS Specification (JSR-311) provides a standard way to create HTTP RESTful services. There are several implementations of JAX-RS: Jersey , RESTEasy, Wink. JAXB (JSR-222) is the standard middleware (objects to / from XML) for JAX-RS and there are several implementations: MOXy , Metro, JaxMe, etc.

These implementations also come with Java EE application servers (i.e. GlassFish , and WebLogic contains Jersey).

Here is an example that I put together using Jersey and MOXy in GlassFish:

+8
source

We recently did some work with Apache CXF and found that JAX-RS support is simple and allows us to write very DRY friendly code.

There is sufficient flexibility, for example. Several different data binding layers.

+2
source

What about XStream? http://x-stream.imtqy.com/

XStream is a simple library for serializing objects in XML and vice versa.

+1
source

My advice would be to not use the binding tool at all. Just consider the fact that what you send over the wire is actually XML. The Spring Web Services Reference Guide describes the rationale for this, called a “contract first,” right here

I understand that you do not want to write a SOAP service, but a REST service. It doesn’t matter for what I do against using the binding tool, the principle of “contract first” is still applied.

Good luck

0
source

Source: https://habr.com/ru/post/897019/


All Articles