user3710293
user3710293

Reputation: 17

How to generate WSDL (WSDL 2.0) for a RESTfull webservice

i'm searching for a methode to generate a WSDL(WSDL2) webservice descriptor for my RESTfull webservice in php.

i know that RESTfull webservice doesn't need a description like SOAP, but i need the WSDL for REST WS to add a semantic annotation for the webservice.

Upvotes: 0

Views: 438

Answers (1)

Dim
Dim

Reputation: 11

You can use tinyWSDL for this.

take a look here to start with. If you use XML Schema you can either add DOM Element or use tinyXMLSchema plugin (+ Apache XML Schema 2.1 libaray).

Types types = description.getTypes();
SchemaTypesExtensions extensions = (SchemaTypesExtensions)types.getComponentExtensions(WSDLPredefinedExtension.SCHEMA.URI);
Schema schema = extensions.newSchema();

// here you can either create a new Schema XmlSchema xmlSchema = (XmlSchema)schema.getSchema();

// or set already parsed one: schema.setSchema(xmlSchema)

In case you don't want to bother with Apache XML Shcema library you can always use DOM Element:

types.addExtensionElement(new QName("http://www.w3.org/2001/XMLSchema", "schema", "xs"), element)

Cheers,

D.

P.S. there is also WSDL 2.0 -> WADL converter in the sourcecode (not in the jar).

Upvotes: 1

Related Questions