WSDL for SOAP and WSDL for REST and JSON based REST

when a company wants to release web services, does it release a separate WSDL for SOAP and share REST-based web services or merge into one WSDL? Can WSDL represent only JSON-based REST web services (not XML)?

Suppose web service clients are Java based.

If SOAP and REST are combined into the same WSDL, does wsimport generate separate classes (for binding XML objects to Java) for SOAP and separately for REST?

+6
source share
3 answers

To describe the REST service, you need WSDL 2.0 (or WADL). Support for WSDL 2.0 is currently very limited, and wsimport does not support it. I am not a Java developer, but I think wsimport is only for SOAP services (JAX-WS and does not support WSDL 2.0).

Edit:

Check this extension . This should allow you to expose the JAX-WS service with JSON encoding. It must also set a "JavaScript proxy" to invoke the JSON service. To more accurately answer your question - I don't think you can describe a REST service without WSDL 2.0 or WADL. Thus, you cannot combine SOAP and REST service with one WSDL 1.1, supported by most stacks. For more information on the JSON service description, check this question .

+6
source

Can WSDL represent only JSON based non-XML REST services

WSDL 2 can describe XML by defining XML types using a schema. See this introduction to WSDL 2 for REST .

Although, TBH, I had never written WSDL for REST before, I just publish URLs and schemes for types.

+2
source

Since the toolkit is not quite there yet, I doubt that many use SOAP and HTTP bindings in the same WSDL. Although both can be introduced in WSDL 2.0, and at the same time, since most people rely on the tools to manage their WSDL today (and the rest of the WS stack), they probably just don’t worry and leave their WSDL alone .

In addition, most REST users build their clients manually, rather than relying on tools and WSDL, so these people currently lack the tools and support them.

When the tools catch up both on the server side and on the client side, most likely, in practice, there will be more applications for binding HTTP services in WSDL 2.0. Whether it remains to be seen whether the idiom will consist in combining specifications in one WSDL or not.

If they want to place them at the same endpoints, they probably will.

+1
source

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


All Articles