' Intercept the execution Public Function InterceptExecution() As Boolean Dim loHttpResponse As System.Web.HttpResponse = Nothing loHttpResponse = System.Web.HttpContext.Current.Response loHttpResponse.Clear() loHttpResponse.ClearContent() loHttpResponse.ClearHeaders() loHttpResponse.ContentType = "text/xml" loHttpResponse.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8") loHttpResponse.Write(cXml) loHttpResponse.End() Return True End FunctionThe cXml property is constructed from a SOAP envelope:
' Return a XML response with a full SOAP envelope Public Function GetXmlSOAPEnvelope() As String Dim lcSOAP As String = "" Dim lcXml As String = "" ' Get the Xml oWebServiceClient.lSuccess = lSuccess oWebServiceClient.lEncode = True If oWebServiceClient.GetXml() Then End If ' Initialization lcXml = oWebServiceClient.cXML lcSOAP = lcSOAP + "<?xml version=""1.0"" encoding=""utf-8""?>" lcSOAP = lcSOAP + "<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" " + "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" " + "xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">" lcSOAP = lcSOAP + "<soap:Body>" lcSOAP = lcSOAP + "<" + cMethod + "Response xmlns=""http://tempuri.org/WebService/Service1"">" lcSOAP = lcSOAP + "<" + cMethod + "Result>" lcSOAP = lcSOAP + lcXml lcSOAP = lcSOAP + "</" + cMethod + "Result>" lcSOAP = lcSOAP + "</" + cMethod + "Response>" lcSOAP = lcSOAP + "</soap:Body>" lcSOAP = lcSOAP + "</soap:Envelope>" Return lcSOAP End FunctionThe oWebServiceClient is simply a class which define a proper protocol for returning the Xml based on our standards.