OpenAPI.NET
OpenAPI.NET copied to clipboard
how to create OpenApiDocument read from WSDL with XML Reader?
Hi,
I am using OpenApiStreamReader
to read a swagger JSON and it's working fine
` string ServiceJson = swaggerLink;
using (var httpClientHandler = new HttpClientHandler())
{
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };
using (var client = new HttpClient(httpClientHandler))
{
client.BaseAddress = new Uri(ServiceJson);
// Make your request...
var stream = await client.GetStreamAsync(ServiceJson);
// Read V3 as YAML
OpenApiDocument openApiDocument = new OpenApiStreamReader().Read(stream, out var diagnostic);}}`
but when I try to read XML from the WSDL link it throws error tell that XML is not supported is there any way to do the same thing with XML?
Hi @Samanoova, as per the error thrown, currently we don't support reading XML documents let alone WSDL. We only support Open API documents in either JSON or Yaml formats. However, we have a Commandline tool - Hidi (Executable file), that helps transform/convert CSDL/XML documents into either JSON/Yaml. Maybe try using that first? Hidi Documentation