svcutil(或任何其他实用程序)可以将 CS 转换回 XSD 吗?
我们有一些生成的代码,很可能是由 svcutil 从 XML 模式 (xsd) 生成的。我们似乎没有使用的原始模式,因此我们希望扭转该过程。我认为 XSD 实用程序是双向的,但是如果我们使用 DataContract 序列化程序怎么办? (我们使用的是VS2010 .net 4.0)。
更新:根据下面@Rene的回答,我提取了模式。但出于好奇,似乎我应该能够将它们转回 C# 并获得与我的 Web 服务接口中使用的相同的 C#?
第 1 步:获取架构 - 这就是我最初在这里提出的要求:
SVCUtil.exe /t:metadata https://myurl.com/EC_DFService/DFExternalService.svc
然后我想将其反转回来,并与我开始使用的 C# 代码进行比较:
SVCUtil.exe /dconly /ser:DataContractSerializer tempuri.org.xsd myurl.com.Project.Name.xsd /o:MessageDataRequestReverse.cs
注意:您还可以从 WSDL 获取 XSD 的 URL,然后检索从浏览器中获取它们,而不使用 SVCUtil 程序,例如: https://myrUrl.com/WebDir/MyService.svc?xsd=xsd0 它们以 xsd0、xsd1、xsd2... 开头,数量根据需要而定。
问题:
1)类的顺序不同(使得并行比较变得不可能)
2)仍然尝试查看类的数量是否相同
3)仍然尝试查看上面的xsd是否可以往返返回到C#,不是 100% 匹配。
We have some code that was generated, mostly likely by svcutil from an XML schema (xsd). We don't seem to have the original schema that was used, so we are hoping to reverse the process. I think the XSD utility goes both directions, but what if we are using DataContract serializer? (We are using VS2010 .net 4.0).
Update: Based on @Rene's answer below, I extracted schemas. But for curiosity, seems like I should then be able to turn them back to C# and get the same C# that was used in the interface to my webservice?
Step1: Get Schemas - which was originally all I was asking here:
SVCUtil.exe /t:metadata https://myurl.com/EC_DFService/DFExternalService.svc
Then thought I would reverse it back, and compare to the C# code I started with:
SVCUtil.exe /dconly /ser:DataContractSerializer tempuri.org.xsd myurl.com.Project.Name.xsd /o:MessageDataRequestReverse.cs
NOTE: You can also get the URL's to the XSD from the WSDL, and just retrieve them from the browser without using the SVCUtil program, example:
https://myrUrl.com/WebDir/MyService.svc?xsd=xsd0
They begin with xsd0, xsd1, xsd2... as many as needed.
Issues:
1) Classes are not in same order (making side-by-compare impossible)
2) Still trying to see if # of classes is even the same
3) Still try to see if the xsd's above can be round-tripped back to the C#, not a 100% match.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
程序集中的协定和数据类型
Contracts and data types in an assembly