How to Create WSDL for Restful WS - rest

I have developed a small RESTful web service example using MyEclipse. I want to create a client for those WS using WSDL. How do I create a WSDL for the above web service using MyEclipse? Please help.

Take a look at this resource. It describes using WSDL 2.0 to describe a REST interface:
http://www.ibm.com/developerworks/webservices/library/ws-restwsdl/#describerestservice

WSDL ? for a REST web service ? i'd suggest you read this book for a better understanding of REST http://oreilly.com/catalog/9780596529260
You don't need WSDL (nor WADL AFAIC) documentation in rest could be plain text for developers, schemas (xsd, rdfs...etc depending on the content types you use) sitemaps for example, a lot of links and post/put templates for example ( to mimic forms in html)

Related

How to configure and call the RSDL or WADL for REST web service?

I want to implement the RSDL or WADL for REST webservice. I got the syntax for it from wiki, but not able to configure it in project. Can anyone tell me how the configuration is done and how to call. Basically how it works as far as workflow is concerned?
Finally I used Jersey for REST webservice implementation. And Jersey auto generates the WADL for the web service. In order to access the WADL, you need to just append the '/application.wadl' to your REST base URL.
For example: "http://www.companyname.com/rest/application.wadl"

Is there a way to take any REST API and generate like WSDL document

I know that REST doesn't have WSDL document as SOAP has (some has WADL but not all, and it is not that common)
Is there a tool that take REST documentation (REST uri maybe) and generate describing document for that web service?
The tool swagger https://editor.swagger.io/ is able to do it only if added annotation to the source code of the web service not to any REST web service.
In short there is no official/REST approved way of doing what you are looking for.
WADL, Swagger and RAML are all "proposed" ways of achieving WSDL like functionality in REST, however they are proposed and not wildly supported by the development community.
If you were to start a new project these would make sense but if you want to run it on top of a existing project and generate some documentation you are pretty much out of luck.

Rest WCF vs Web api

I read some articles and i search many about differences between Rest WCF vs Web api but I just find difference between WCF vs Web api , I find some difference:
WCF Rest=>
a)It support HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively.
b)To enable other HTTP verbs you have to do some configuration in IIS to accept request of that particular verb on .svc files.
c)Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified.
d)It support XML, JSON and ATOM data format.
and
WebApi=> a)Unlike WCF Rest service, it use the full featues of HTTP (like URIs, request/response headers, caching, versioning, various content formats).
b)Responses are formatted by Web API’s MediaTypeFormatter into JSON, XML or whatever format you want to add as a MediaTypeFormatter.
I want know other differences between them, and when is it better to use WebApi and when Rest Wcf?
I would say, if you start a new project and you need to expose a REST web interface in .NET, Web API is the way to go because AFAIK, WCF is deprecated. I would only consider to use WCF Rest if you have to expose both, SOAP and REST web interfaces.
WCF is not the good choice for REST because it was not made for it, when they implemented it they did lots of bad hacks. you can see how they try to convert xml to josn here
WCF is NOT deprecated, so powerful, and no framework can be comparable to it yet. but it is not for REST.

HDIV Integration with RESTful webservice

I'm creating a web application containing RESTful webservices and I was wondering how I can properly integrate HDIV with this part of my webapp.
For now, I'm defining each webservice URL as startPage:
<hdiv:startPages>/ws/ws1,/ws/ws2,...</hdiv:startPages>
Is there a way to change that? does <hdiv:startPages>/ws/*</hdiv:startPages> or something like that exists?
You can use Java patterns to define start pages:
<hdiv:startPages>/ws/.*</hdiv:startPages>
Anyway, you can try Spring HATEOAS and Hdiv's experimental integration to securize the REST services.

Generate REST from WSDL

I'm looking for best way to automate generation of REST ws.
We have collection of web services (SOAP) with WSDLs generated for them. I was required to provide different APIs to invoke these web services. (PHP, Pyton, REST, CLI ...)
One of requirement is to have REST API for these ws.
What is the best way to generate REST client/server, is there any automatic tools for that?
There is a chance that WSDLs will change each release.
Thanks
It's not possible to generate REST API from WSDL. You can't mix oranges and apples
SOAP is a protocol build on top of HTTP. A WebService is represented by a set of methods/actions. You can see a WebService as sophisticated RPC. Generally we can say that WebServices are about verbs, to call remote methods/actions. A WebService also doesn't have uniform interface and that's the reason why WSDL exists.
REST is architectural style (scope is broader than just API). REST API is represented by a set of resources and representations. A resource is source of an information and is managed via uniform interface. Generally we can say that REST API is about nouns. Because all resources must have uniform interface there is no need for WADL (an unsuccessful attempt to create something like WSDL for REST).
I doubt you can automatically transform verbs into nouns, etc.
Please check the below article that describes how to use WSDL2.0 to describe REST Services. It can only be used if the intended message format is XML.
https://www.ibm.com/developerworks/library/ws-restwsdl/
Instead of rewriting an existing SOAP-based web service, use API Express to present it as a mobile-ready REST service. No conversion necessary. Continue to run the SOAP service and, with a WSDL file and a few configuration parameters, it can easily be integrated into mobile apps as a REST service.
How to Expose a WSDL Service (SOAP) as REST API: https://dzone.com/articles/how-to-expose-a-wsdl-service-soap-as-rest-api
Appery.io API Express: https://appery.io/api-express/