问题描述
我正在尝试解析 WSDL,按照给出的示例 这里.
I am attempting to parse WSDL, along the lines of the example given here.
作者在评论中指出,该示例无法深入研究复杂的数据类型.
The author notes, in the comments, that the example is not capable of drilling down into complex data types.
事实上,当我运行该示例时,它似乎甚至无法处理简单的数据类型.
And in fact, when I run the example, it does not appear to even handle simple data types.
我在示例中使用的 System.Web.Services.Description.ServiceDescription 类中四处寻找,但在运行时找不到任何实际参数或返回类型信息.我知道我可能需要手动解析 xsd 文件?
I have poked around in System.Web.Services.Description.ServiceDescription class, which is used in the example, but cannot find any actual parameter or return type information at run-time. I gather that I may need to do some manual parsing of an xsd file?
google 和 stackoverflow 似乎都缺乏如何以编程方式深入研究复杂类型的完整示例,所以......我应该怎么做?
Both google and stackoverflow appear to lack a complete example of how to drill down into complex types programmatically, so... how should I do this?
推荐答案
这并不漂亮 - 但它完成了工作(希望;).我将此代码部分基于您提供的链接,然后添加了一些递归来解析架构中包含的不同类型,以及内部元素及其数据类型.这绝对没有考虑到 XML 模式中的所有可能性,但我认为它足以说明您可以在必要时增加复杂性.
This is not pretty - but it gets the job done (hopefully ;). I based this code partly on the link you provided, and then added some recursion to parse out the different types included in the schema, as well as the inner elements and their data types. This definitely does not take into account all possiblities in an XML schema, but I think it exemplifies enough that you could add complexity to this if neccessary.
希望对你有帮助!!!!
I hope this helps!!!!
这篇关于解析复杂的 WSDL 参数信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!