Created
March 10, 2018 04:26
-
-
Save davidruhmann/86dadabcb8103f2c133abcbd8504ac07 to your computer and use it in GitHub Desktop.
fileorurl.cs
This file contains 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
using System; | |
using System.IO; | |
using System.Net.Http; | |
using System.Xml.Linq; | |
namespace wsdl2class | |
{ | |
class Program | |
{ | |
public static HttpClient client = new HttpClient(); | |
static void Main(string[] args) | |
{ | |
string wsdl; | |
if (File.Exists(args[0])) | |
{ | |
wsdl = File.ReadAllText(args[0]); | |
} | |
else | |
{ | |
var url = new Uri(args[0]); | |
var response = client.GetAsync(url).Result; | |
if (!response.IsSuccessStatusCode) | |
{ | |
throw new Exception($"failed to retrieve the wsdl from {args[0]}\n{response.StatusCode}"); | |
} | |
wsdl = response.Content.ReadAsStringAsync().Result; | |
} | |
var xDoc = XDocument.Load() | |
Console.WriteLine("Hello World!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment