Skip to content

Instantly share code, notes, and snippets.

@KodeSeeker
Created February 28, 2013 05:25
Show Gist options
  • Save KodeSeeker/5054431 to your computer and use it in GitHub Desktop.
Save KodeSeeker/5054431 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Net;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void btnSubmit_click(object sender, EventArgs e)
{
string urlName = txtinput1.Text;
string showVal="Empty" ;
ArrayList UrlList=getWsdlAddress(urlName);
foreach(string i in UrlList){
showVal+=i;
}
Label1.Text = showVal;
}
public ArrayList getWsdlAddress(string url)
{
char[] stringSeperatorArray = new char[] { ' ', ',', '"', '#', '(', ')', '{', '}', '%', '@', '=', '+', '-', '*', '|', ';', '$', '<', '>', '[', ']' };
string[] extensionSplitter = new string[] { "?wsdl", ".wsdl" };
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
myRequest.Method = "GET";
WebResponse myResponse = myRequest.GetResponse();
StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
string result = sr.ReadToEnd();
sr.Close();
myResponse.Close();
ArrayList URLList = new ArrayList();
string[] URLCompleteList = result.Split(stringSeperatorArray, StringSplitOptions.RemoveEmptyEntries);
foreach (string word in URLCompleteList)
{
if (word.Contains(".wsdl") || word.Contains("?wsdl"))
{
URLList.Add(word);
}
}
return URLList;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment