使用 svcutil.exe 生成接口时出错

发布于 2024-10-08 23:39:57 字数 1146 浏览 3 评论 0原文

有人可以帮我生成以下 OGC 架构的接口 (c#) 文件吗?

架构文件:下载架构文件链接

我需要为上面架构 zip 文件中的 Ordering wsdl 创建 Web 服务。我已经研究了好几天了,但没有成功生成界面。我已经尝试过:

svcutil.exe thewsdl.wsdl /language:c# /out:ITheInterface.cs

svcutil Order.wsdl /out:IOrder.cs

svcutil Order.wsdl Order.xsd ..\ws-addressing\ws-addr.xsd /out:IOrder.cs

svcutil Order.wsdl Order.xsd ws-addr.xsd /out:IOrder.cs

并且出现以下错误:

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot read ws-addr.xsd.

    Cannot load file D:\Documents\DEV\SARPilot\Docs\eoschema\schema\OrderSchema\ws-addr.xsd as an Assembly. Check the FusionLogs f
or more Information.

    Could not load file or assembly 'file:///D:\Documents\DEV\SARPilot\Docs\eoschema\schema\OrderSchema\ws-addr.xsd' or one of its
 dependencies. The module was expected to contain an assembly manifest.

Can someone help me generate the Interface (c#) file for the following OGC schema?

Schema files: Download Schema Files Link

I need to create web services for the Ordering wsdl in the schema zip file above. I've been at it for days now with no luck generating the interface. I've tried:

svcutil.exe thewsdl.wsdl /language:c# /out:ITheInterface.cs

svcutil Order.wsdl /out:IOrder.cs

svcutil Order.wsdl Order.xsd ..\ws-addressing\ws-addr.xsd /out:IOrder.cs

svcutil Order.wsdl Order.xsd ws-addr.xsd /out:IOrder.cs

and i get the following error:

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.0.30319.1]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot read ws-addr.xsd.

    Cannot load file D:\Documents\DEV\SARPilot\Docs\eoschema\schema\OrderSchema\ws-addr.xsd as an Assembly. Check the FusionLogs f
or more Information.

    Could not load file or assembly 'file:///D:\Documents\DEV\SARPilot\Docs\eoschema\schema\OrderSchema\ws-addr.xsd' or one of its
 dependencies. The module was expected to contain an assembly manifest.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

假情假意假温柔 2024-10-15 23:39:57

好的,所以我已经克服了这个错误。 (我现在得到更多,但这些是另一个问题)。

我在 VS2010 中打开 ws-addr.xsd 文件并查看警告列表。一位说:

警告 105 XML 编辑器试图
将此 DTD 转换为 XSD,以便可以
提供验证和智能感知
当你打字时,但它不能
创建有效的 XSD 架构。也许
此 DTD 使用的结构不
映射到 XSD。你也许能够得到
有关该问题的更多信息
使用创建架构
命令。 D:\Documents\DEV\SARPilot\Docs\eoschema\schema\ws-addressing\ws-addr.xsd 3 11 D:...\schema\

所以我去了“http://www.w3.org/ 2005/08/addressing/ws-addr.xsd”并下载正确的并替换它。

我不再收到警告 105,也不再收到 svcutil 的“无法加载文件”错误

Okay, so i've gotten past this error. (i get more now, but those are for another question).

I opened the ws-addr.xsd file in VS2010 and looked down the warnings list. one said:

Warning 105 The XML editor tried to
convert this DTD to XSD so it can
provide validation and intellisense
while you type, but it could not
create a valid XSD schema. Perhaps
this DTD uses constructs that do not
map to XSD. You may be able to get
more information about the problem by
using the Create Schema
command. D:\Documents\DEV\SARPilot\Docs\eoschema\schema\ws-addressing\ws-addr.xsd 3 11 D:...\schema\

So i man went to "http://www.w3.org/2005/08/addressing/ws-addr.xsd" and downloaded the correct one and replaced it.

I no longer got the warning 105, and no longer get the "Could not load file" error with svcutil

空心↖ 2024-10-15 23:39:57

另一件需要注意的事情是 wsdl 文件的编码。我收到了一个 wsdl 文件,但它没有使用 UTF-8 编码,因此我收到了“无法加载文件或程序集”消息。事实上,它所说的汇编完全是误导性的,就像微软错误经常出现的情况一样。在我看来,错误消息中应该禁止使用“或”一词。无论如何,解决方案是在 Notepad++ 中打开 wsdl 并转换为 UTF-8。 (编码-转换为UTF-8)

Another thing to be aware of is the encoding of the wsdl file. I received a wsdl file but it was not encoded with UTF-8 and so I got the 'could not load file or assembly' message. The fact that it says assembly is completely misleading, as is often the case with Microsoft errors. In my opinion the word "or" should be banned from error messages. Anyway the soloution was to open the wsdl in Notepad++ and convert to UTF-8. (Encoding-Convert to UTF-8)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文