Created
May 12, 2017 10:27
-
-
Save EtherZa/085729a77cd92f53bc5838f308f34386 to your computer and use it in GitHub Desktop.
Generate WCF service from WSDL (URL hosted) and rewrite fields as properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = "http://<url>?WSDL" | |
$name = "<Service Name>" | |
$namespace = "<Base Namespace>." + $name | |
$file = "$name.generated.cs" | |
echo "Generating service $name ($url)" | |
& "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\SvcUtil.exe" /t:code $url /language:C# /n:"*,$namespace" /out:$file /noConfig /syncOnly | out-null | |
(Get-Content $file) | Foreach-Object {$_ -replace "(?<=public [\w\.]+(?:\[\])? \w+)(;)", " { get; set; }"} | Set-Content $file | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment