如何在JAVA中为WSDL中定义的REST生成RESTful客户端 [英] How to generate RESTful client in JAVA for REST defined in WSDL

查看:203
本文介绍了如何在JAVA中为WSDL中定义的REST生成RESTful客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道WSDL用于定义基于SOAP的Web服务,但在我在网上看到的大多数WSDL中,WSDL中还定义了RESTfulweb服务-http:binding。

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.

为SOAP生成客户端我从JAX-WS使用wsimport工具(它还为REST生成客户端类但它不起作用)。

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).

所以问题是,如何基于WSDL生成REST客户端?

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

推荐答案

我从未听说有人使用WSDL生成REST客户端。 WADL是的,但不是WSDL。

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

无论如何,为REST服务生成客户端没有意义。如果您认为自己想要这样做,那么您就会错过REST的好处,并且尝试遵循REST约束将使您无需额外工作。

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.

这篇关于如何在JAVA中为WSDL中定义的REST生成RESTful客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆