Skip to content

Instantly share code, notes, and snippets.

@dcinzona
Last active October 24, 2024 12:06
Show Gist options
  • Save dcinzona/2552cc7c2935eb0803852c4f0cab45e2 to your computer and use it in GitHub Desktop.
Save dcinzona/2552cc7c2935eb0803852c4f0cab45e2 to your computer and use it in GitHub Desktop.
Convert WSDL to CSharp

Converting a WSDL to C# using dotnet core

Install dotnet core

  1. Go to https://dotnet.microsoft.com/download and install
  2. If using ZSH (z-shell), add these to your config (.zshrc)
    1. Add to your PATH export :$HOME/dotnet
    2. Add to the bottom export DOTNET_ROOT=$HOME/dotnet
    3. Optional Add an alias for svcutil at the bottom alias dotnet-svcutil="dotnet svcutil $1"
  3. Verify dotnet is installed and working from the command line
    1. Open terminal and run dotnet --version
  4. Install dotnet-svcutil globally: dotnet tool install dotnet-svcutil --global

Create a project

  1. Create a new directory where you want to generate the files (ex: mkdir wsdlcsharp)
  2. Enter the dir and initialize the project
    1. cd wsdlcsharp
    2. dotnet new web

Process the WSDL

  1. Save the WSDL file locally or use the WSDL URL if available for the following command dotnet-svcutil [WSDL File or URL] (ex: dotnet-svcutil ../ws_1.wsdl)
  2. Look in the directory, you should have a ServiceReference folder with a References.cs

Open References.cs in your favorite editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment