How to generate RESTful client in JAVA for REST de

2019-01-11 21:14发布

I know that WSDL is for defining SOAP based web services but in most of the WSDLs I saw on net, in the WSDL is defined also RESTful "web service"-http:binding.

To generate client for the SOAP I used wsimport tool from JAX-WS (it also generates client classes for the REST but it doesnt work).

So the question is, how to generate REST client based on the WSDL?

4条回答
Ridiculous、
2楼-- · 2019-01-11 21:26

IBM Developer network: WSDL2 can describe REST services.

I think in programmers mainstream is holy war SOAP (classic) - REST services. Nobody want this war, these conceptions can coexist - i see this is opinion not only from my and few people, but has grooving support in standards.

查看更多
乱世女痞
3楼-- · 2019-01-11 21:31

Actually you can auto-generate a SOAP like stub for JAX-RS but it uses WADL which I believe is a WSDL variant.

Apache CXF does this and if that doesn't work for you it will also automatically create SOAP endpoints and SOAP clients.

查看更多
手持菜刀,她持情操
4楼-- · 2019-01-11 21:35

I've never heard of anyone using WSDL for generating REST clients. WADL yes, but not WSDL.

Anyway, generating clients for REST services does not make sense. If you think you want to do that then you are missing the benefits of REST and trying to follow the REST constraints is going to make you do extra work for nothing.

查看更多
ら.Afraid
5楼-- · 2019-01-11 21:51

You can use RestDescribe to generate and compile WSDL, you can generate clients in php, ruby, python, java and C# using this. It generates clean code and there is a good change that you have to tweak it a bit after code generation, you can find good documentation and underlying thoughts behind the tool here.

There are few interesting and useful WADL tools mentioned on wintermute.

查看更多
登录 后发表回答