如何从节点js中的wsdl生成xsd

时间:2022-11-24 23:24:24

How to generate xsd from wsdl in node js

如何从节点js中的wsdl生成xsd

We have a requirement to validate a request with the associated XSD in node js.

我们要求在节点js中使用关联的XSD验证请求。

I found one npm which does the job called "xsd-schema-validator" which requires xsd but i only have WSDL, not xsd "can anyone please help me on how to generate xsd from WSDL in nodejs"

我发现一个npm做了一个名为“xsd-schema-validator”的工作,它需要xsd,但我只有WSDL,而不是xsd“任何人都可以帮助我如何从nodejs中的WSDL生成xsd”

Thank you.

谢谢。

1 个解决方案

#1


0  

If you have a URL to your XML Schema, you can use something like node-fetch to follow the link:

如果您有XML Schema的URL,则可以使用类似node-fetch的内容来跟踪链接:

var fetch = require('node-fetch');     

fetch('https://location-of-schema')      
 .then(res => res.text())         
 .then(body => console.log(body));

Check the node-fetch documentation for more options in dealing with what you get back (save to a file, process on the fly, ...).

检查node-fetch文档以获取更多选项来处理您的回复(保存到文件,动态处理,...)。

Now, you can use your xsd-schema-validator to validate your payload against the fetched XML Schema.

现在,您可以使用xsd-schema-validator根据获取的XML Schema验证有效负载。

#1


0  

If you have a URL to your XML Schema, you can use something like node-fetch to follow the link:

如果您有XML Schema的URL,则可以使用类似node-fetch的内容来跟踪链接:

var fetch = require('node-fetch');     

fetch('https://location-of-schema')      
 .then(res => res.text())         
 .then(body => console.log(body));

Check the node-fetch documentation for more options in dealing with what you get back (save to a file, process on the fly, ...).

检查node-fetch文档以获取更多选项来处理您的回复(保存到文件,动态处理,...)。

Now, you can use your xsd-schema-validator to validate your payload against the fetched XML Schema.

现在,您可以使用xsd-schema-validator根据获取的XML Schema验证有效负载。