I have generated stubs from a wsdl file in a asp.net web app. My question is how do i add those function calls to a httpwebrequest? I have gotten this far but dont know how to finish it off and send the soap off on the wire.
public HttpWebRequest CreateWebRequest(string webMethod)
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("");
webRequest.Headers.Add(@"SOAPAction", "\"http://www.multispeak.org/Version_3.0/"+ webMethod +"\"");
webRequest.ContentType = "text/xml;charset=\"utf-8\"";
webRequest.Accept = "text/xml";
webRequest.Method = "POST";
return webRequest;
}
protected void Button1_Click(object sender, EventArgs e)
{
MR_ServerSoapClient soapClient = new MR_ServerSoapClient(endPoint,uri);
PingURLRequest request = new PingURLRequest();
PingURLResponse response = new PingURLResponse();
}
I am not sure why you would not use the client methods generated for you, but:
using (var response = (HttpWebResponse)webRequest.GetResponse())
{
var reader = new StreamReader(response.GetResponseStream());
var result = reader.ReadToEnd();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.