Skip to content

Instantly share code, notes, and snippets.

@davidruhmann
Created March 10, 2018 04:26
Show Gist options
  • Save davidruhmann/86dadabcb8103f2c133abcbd8504ac07 to your computer and use it in GitHub Desktop.
Save davidruhmann/86dadabcb8103f2c133abcbd8504ac07 to your computer and use it in GitHub Desktop.
fileorurl.cs
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