xml - Unable to make request using SOAP to a webservice -


My requirement is that I will have SOAP data in XML. I will read from the file, and then send the request for a webservice. So, I have to write a file answer. I'm using vs. 2005

  XmlDocument doc = New XmlDocument (); Doc.Load (@ "Path xml file"); HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.w3schools.com/webservices/tempconvert.asmx"); 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 (); Streamerdinder r = new streamrider (STM); Console.WriteLine (r.ReadToEnd ());  

You have not really told what problem you faced, what you expected to happen What were they doing and actually?

Anyway, it seems that the web service you are trying to call was an ASP.NET web service (estimated from .msm extension at URL). I suspect that the problem was in your SOAPAction header, which should be set to the web service namespace corresponding to the Web method name. In your example, I think it would be http://tempuri.org/CelciusToFahrenheit . You have & lt; CelciusToFahrenheit & gt; There is also an incorrect XML name locale on the element, it should be http://tempuri.org .

He said, this is not really a good way to consume web services from C #. For web service, you must add the WSDL as a web context for the web service and then call the generated class to open the web service functionality.

The service you are calling for is an ASP.NET web service, when the documentation is in progress, you can actually complete the request and response format

can see

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -