<% if Request.ServerVariables("CONTENT_TYPE") = "text/xml-SOAP" then if Request.ServerVariables("HTTP_INTERFACENAME") <> "soap:cdl:com.develop.soapdemo.VBSoapSrv._VBSoapTest" then response.write "Unexpected interface name" response.end end if if Request.ServerVariables("HTTP_METHODNAME") <> "Translate" then response.write "Unexpected method name" response.end end if if Request.ServerVariables("HTTP_MESSAGETYPE") <> "Call" then response.write "Unexpected call type" response.end end if ' Everything is OK at the interface/method/messagetype level so invoke ProcessSOAPRequest else response.Write "Unexpected content type" RaiseSOAPFault end if Sub RaiseSOAPFault response.write "TODO: Create a soap fault!" End Sub ' ' Purpose: Processes the SOAP request. ' Sub ProcessSOAPRequest if Request.ServerVariables("REQUEST_METHOD") = "POST" then ' Load the posted XML document set oRequest = Server.CreateObject("Microsoft.XMLDOM") oRequest.load(Request) x = oRequest.selectSingleNode("//Translate/p/x").text y = oRequest.selectSingleNode("//Translate/p/y").text set oResponse = Server.CreateObject("Microsoft.XMLDOM") dim oDocElement set oDocElement = oResponse.createElement("soap:SerializedStream") oDocElement.setAttribute "xmlns:soap", "http://w3.org/Schemas/SOAP/kw" oDocElement.setAttribute "soap:headers", "#x1" oDocElement.setAttribute "soap:mean", "#x2" oDocElement.setAttribute "soap:serializationPattern","urn:schemas-microsoft-com:soap.v1" oResponse.appendChild oDocElement ' ' Create the SOAP headers ' dim oHeaderElement set oHeaderElement = oResponse.createElement("soap:headers") oHeaderElement.setAttribute "soap:id", "x1" oDocElement.appendChild oHeaderElement ' Setup the interface name dim oInterfaceName set oInterfaceName = oResponse.createElement("soap:InterfaceName") oInterfaceName.setAttribute "soap:type", "string" oHeaderElement.appendChild oInterfaceName oInterfaceName.text = "soap:cdl:com.develop.soapdemo.VBSoapSrv._VBSoapTest" ' ' Create the method response ' dim oMethodResp set oMethodResp = oResponse.createElement("TranslateResponse") oDocElement.appendChild oMethodResp oMethodResp.setAttribute "soap:id", "x2" ' Create the Compound Element ( basically a structure ) dim oCompoundParam set oCompoundParam = oResponse.createElement("p") oMethodResp.appendChild oCompoundParam oCompoundParam.setAttribute "soap:type", "soap:cdl:com.develop.soapdemo.VBSoapSrv.point" ' Create the x element dim oX set oX = oResponse.createElement("x") oX.text = CInt(x) * 2 oCompoundParam.appendChild oX oCompoundParam.setAttribute "soap:type", "i4" ' Create the y element dim oY set oY = oResponse.createElement("y") oCompoundParam.appendChild oY oCompoundParam.setAttribute "soap:type", "i4" oY.text = CInt(y) * 4 Response.ContentType = "text/xml-SOAP" Response.Write oResponse.xml else Response.ContentType = "text/xml"' end if end sub %>