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

时间:2019-06-24 05:36:25

标签: c# soap wsdl onvif

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

我正在Arch Linux上使用通用文本编辑器。我希望该解决方案尽可能基于控制台。

在有效且可编译/正在运行的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的服务定义生成源文件?

1 个答案:

答案 0 :(得分:0)

您可以使用.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

我从不使用单声道来生成代码。