Use dynamically generated SOAP request
<?xml version='1.0' encoding='UTF-8'?>
<!-- Note that the Body contents could be any valid SOAP request -->
<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'>
<Body>
<find_business generic='1.0' xmlns='urn:uddi-org:api'>
<name>Microsoft</name>
</find_business>
</Body>
</Envelope>
You can save this to your web folder as "uddi.xml".
Now let's construct the ASPX page that will receive the querystring parameters, send out the request, and return the result:
<% @ Page Language="C#" %>
<% @Import Namespace="System" %>
<% @Import Namespace="System.Xml" %>
<% @Import Namespace="System.Text" %>
<% @Import Namespace="System.IO" %>
<% @Import Namespace="System.Net" %>
<script Language="C#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string xmlfile;
xmlfile=Request.Params["xmlfile"];
if (xmlfile==null)
xmlfile="uddi.xml";
HttpSOAPRequest(xmlfile,null);
}
void HttpSOAPRequest(String xmlfile, string proxy)
{
XmlDocument doc = new XmlDocument();
doc.Load(@"C:\Inetpub\wwwroot\ASP.NET\" +xmlfile);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://uddi.microsoft.com/inquire");
if (proxy != null) req.Proxy = new WebProxy(proxy,true);
// if SOAPAction header is required, add it here...
req.Headers.Add("SOAPAction","\"\"");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestStream();
doc.Save(stm);
stm.Close();
WebResponse resp = req.GetResponse();
stm = resp.GetResponseStream();
StreamReader r = new StreamReader(stm);
// process SOAP return doc here. For now, we'll just send the XML out to the browser ...
Response.Write(r.ReadToEnd());
}
</script>
http://www.eggheadcafe.com/articles/20011103.asp
-Paresh