POST /barry.cornelius/moving/WebServerConvert/Service1.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: XXXX SOAPAction: "http://www.dur.ac.uk/barry.cornelius/webservices/ToFahrenheit" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ToFahrenheit xmlns="http://www.dur.ac.uk/barry.cornelius/webservices/"> <pCentigrade>0</pCentigrade> </ToFahrenheit> </soap:Body> </soap:Envelope>
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: YYYY <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ToFahrenheitResponse xmlns="http://www.dur.ac.uk/barry.cornelius/webservices/"> <ToFahrenheitResult>32</ToFahrenheitResult> </ToFahrenheitResponse> </soap:Body> </soap:Envelope>
[WebService] public class Service1 : System.Web.Services.WebService { ... [WebMethod] public double ToFahrenheit(double pCentigrade) { return 32 + pCentigrade*9/5; } }
public class Service1 : System.Web.Services.Protocols.SoapHttpClientProtocol { ... public double ToFahrenheit(double pCentigrade) { object[] results = this.Invoke("ToFahrenheit", new object[]{pCentigrade}); return (double) results[0]; } ... }
Proxy.Service1 tService1 = new Proxy.Service1(); double tFahrenheit = tService1.ToFahrenheit(tCentigrade);