Search code examples
c#soapwsdlonvif

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


Im trying to generate a C Sharp source file that contains the network interfaces provided by ONVIF using wsdl-soap service specifications, specifically as listed:

I am using a general purpose text editor on Arch Linux. I would like the solution to be console-based if possible.

With a valid and compilable/running csproj, ive used the command wsdl and wsdl2 to try generate the desired output file. The process exits with an empty output and the error:

[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

The contents of the output.cs file were empty, it contained some comments, but nothing of use (comments specified that the file was auto-generated).


How would I generate a source file using ONVIF's service definitions on Arch Linux using the console?


Solution

  • You can use .Net Core and install dotnet-svcutil with the command:

    dotnet tool install --global dotnet-svcutil
    

    At this point you can run

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

    I was never able to generate the code by using mono.