<% @LANGUAGE="JavaScript" %> <% // cmSOAPListener.asp // ------------------ // Respond to SOAP requests // ----------------------------------------------------------------- var cmSOAPURI = "www.craigmurphy.com"; %> <% // ----------------------------------------------------------------- // SOAP Entry Code // ----------------------------------------------------------------- var SOAPEnvelope = Server.CreateObject("Microsoft.XMLDOM"); //var SOAPEnvelope = Server.CreateObject("MSXML2.FreeThreadedDOMDocument"); // Load the SOAP envelope SOAPEnvelope.async = false; SOAPEnvelope.load (Request); Response.ContentType="text/xml"; // Extract the method var smn = new String(Request.ServerVariables("HTTP_SOAPACTION")); var sSOAPActionMethod = smn.substring(smn.lastIndexOf("#") + 1, smn.length); SOAPPrefix = SOAPEnvelope.documentElement.prefix; var oBody = SOAPEnvelope.selectSingleNode("//" + SOAPPrefix + ":Body"); var oMethod = oBody.firstChild; var sMethod = oMethod.baseName; // Which method? if (sSOAPActionMethod == sMethod) switch (sMethod) { case "Add": X = oBody.selectSingleNode("//X"); Y = oBody.selectSingleNode("//Y"); nTotal = parseFloat(X.text) + parseFloat(Y.text); var s = ""; s=s+''; s=s+'<'+SOAPPrefix+':Envelope xmlns:'+SOAPPrefix+'="http://schemas.xmlsoap.org/soap/envelope">'; s=s+'<'+SOAPPrefix+':Body>'; s=s+''; s=s+''+nTotal+''; s=s+''; s=s+''; s=s+''; Response.Write(s); break; default: // method is undefined Response.Write(SOAPEnvelope.xml); } %>