Importing REST services using API

Hi!
I want to import a service/REST service to CS using API. With service and attached wsdl it works flawlessly, but fails when importing REST service. Checked on CS 9.6, 9.7 and 9.9.

Fails on code:

WebServiceRegistrator wsr = new WebServiceRegistrator(wsdl.getAbsolutePath(), hlp.getJAXR(), importParameters, null, null);

where “wsdl” is the part to actual wsdl file.

Error when importing REST service:
WSDLException (at /wsdl:description): faultCode=INVALID_WSDL: Expected element ‘{http://schemas.xmlsoap.org/wsdl/}definitions’.
javax.wsdl.WSDLException: WSDLException (at /wsdl:description): faultCode=INVALID_WSDL: Expected element ‘{http://schemas.xmlsoap.org/wsdl/}definitions’.
at com.ibm.wsdl.xml.WSDLReaderImpl.checkElementName(WSDLReaderImpl.java:2167)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:248)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2352)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2316)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2369)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2390)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2422)
at com.centrasite.jaxr.webservice.WebServiceAbstractAnalyzer.getWSDLDefinition(WebServiceAbstractAnalyzer.java:553)
at com.centrasite.jaxr.webservice.WebServiceAnalyzer.(WebServiceAnalyzer.java:59)
at com.centrasite.jaxr.webservice.WebServiceRegistrator.(WebServiceRegistrator.java:524)

I guess WebServiceRegistrator class is not supporting REST? Should I use different class? I tried to find suitable one but no luck.
Any ideas?

Hi Radek,

Usually, REST services are not specified via WSDL, but SWAGGER or RAML.

Also, AFAIK, REST support until 9.8 is not so great.

Best regards,
Vlad Turian

Could anyone please post sample code snippet of importing REST services in CS in bulk. CS version 9.8+
If this sample exist in any documentation pointer is appreciated as well