在 linux 上使用 ONVIF 的 .wsdl 文件生成 C# 脚本

Generating C# script with ONVIF's .wsdl files on linux

我正在尝试生成一个 C Sharp 源文件,其中包含 ONVIF 使用 wsdl-soap 服务规范提供的网络接口,具体如下所列:

我在 Arch Linux 上使用通用文本编辑器。如果可能的话,我希望解决方案是基于控制台的。

使用有效的 compilable/running csproj,我使用命令 wsdlwsdl2 尝试生成所需的输出文件。该进程以空输出和错误退出:

[connor@archlinux /home/connor/Workspace/csharp/Camera]
 $ ls
bin  Camera.csproj  obj  ONVIF.cs  Program.cs
[connor@archlinux /home/connor/Workspace/csharp/Camera]
 $ wsdl https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl
Web Services Description Language Utility
Mono Framework v4.0.30319.42000

There were some warnings while generating the code:

  https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl
    - This web reference does not conform to WS-I Basic Profile v1.1
        Rxxxx: HelpGeneratorServiceConformanceRxxxx

Writing file 'output.cs'
[connor@archlinux /home/connor/Workspace/csharp/Camera]
 $ ls
bin  Camera.csproj  obj  ONVIF.cs  output.cs  Program.cs

output.cs 文件的内容是空的,其中包含一些评论,但没有任何用处(评论指出该文件是自动生成的)。


我如何使用控制台在 Arch Linux 上使用 ONVIF 的服务定义生成源文件?

您可以使用 .Net Core 并使用以下命令安装 dotnet-svcutil:

dotnet tool install --global dotnet-svcutil

此时你可以运行

dotnet-svcutil.exe https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl -o devicemgmt.cs

我一直无法使用单声道生成代码。