Hello,
I wrote a classic ASP page using vbscript to send a request via SOAP to a webservice. I cannot figure out how to pass the result to an XSL page I have. Any ideas would be greatly appreciated where I have gone wrong.
SOAP request:
' Build custom HTTP header
xmlServerHttp.open "POST", "https://.../Site.asmx", False ' False = Do not respond immediately
xmlServerHttp.setTimeouts lResolve, lConnect, lSend, lReceive
xmlServerHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlServerHttp.setRequestHeader "Content-Length", Len(SoapBodyStr)
xmlServerHttp.setRequestHeader "SOAPAction", "http://tempuri.org/GetSiteDetail"
xmlServerHttp.send(SoapBodyStr)
SOAP response:
Dim oXmlsrc, oRootNode, oXslsrc, newXML, re, oXslTemplate, oXslProcessor
' If you're using an XSLTemplate and XSLProcessor object,
' you have to use the FreeThreaded versions of DOMDocument
Set oXmlsrc=CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
Call oXmlsrc.setProperty("ServerHTTPRequest", True)
oXmlsrc.async=False
oXmlsrc.loadxml(xmlResponse) ????????????
Set oXslsrc=CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
Call oXslsrc.setProperty("ServerHTTPRequest", True)
oXslsrc.async=False
Set oXslTemplate = Server.CreateObject("MSXML2.XSLTemplate.4.0")
' If I haven't posted the form first, then load my unaltered XML.
' If I'm posting info to resort or edit, then build my XML from that.
'On Error Resume Next 'debugging code
If Request.Form("acctname") = "" Then
Call oXmlsrc.load(xmlServerHttp.responseXML) ??????
'Response.Write "<!-- " & oXmlSrc.xml & " -->" 'debugging code
newXML=oXmlsrc.xml
Set re=new regexp
re.pattern=" xmlns.+?>"
newXML=re.replace(newXML,">")
Call oXmlsrc.loadxml(newXML)
else
'Build a DOM that looks exactly like the one coming from the web service
'That way XSL can't tell the difference.
'The XML DOM is empty at this stage so we need to load it with the root node
...
if oXslsrc.load(Server.MapPath("verifyaccount.xsl")) then
Set oXslTemplate.stylesheet = oXslsrc
Set oXslProcessor = oXslTemplate.createProcessor()
oXslProcessor.input = oXmlsrc
else
Set oMailer = Server.CreateObject("Persits.MailSender")
...
I wrote a classic ASP page using vbscript to send a request via SOAP to a webservice. I cannot figure out how to pass the result to an XSL page I have. Any ideas would be greatly appreciated where I have gone wrong.
SOAP request:
' Build custom HTTP header
xmlServerHttp.open "POST", "https://.../Site.asmx", False ' False = Do not respond immediately
xmlServerHttp.setTimeouts lResolve, lConnect, lSend, lReceive
xmlServerHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlServerHttp.setRequestHeader "Content-Length", Len(SoapBodyStr)
xmlServerHttp.setRequestHeader "SOAPAction", "http://tempuri.org/GetSiteDetail"
xmlServerHttp.send(SoapBodyStr)
SOAP response:
Dim oXmlsrc, oRootNode, oXslsrc, newXML, re, oXslTemplate, oXslProcessor
' If you're using an XSLTemplate and XSLProcessor object,
' you have to use the FreeThreaded versions of DOMDocument
Set oXmlsrc=CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
Call oXmlsrc.setProperty("ServerHTTPRequest", True)
oXmlsrc.async=False
oXmlsrc.loadxml(xmlResponse) ????????????
Set oXslsrc=CreateObject("MSXML2.FreeThreadedDOMDocument.4.0")
Call oXslsrc.setProperty("ServerHTTPRequest", True)
oXslsrc.async=False
Set oXslTemplate = Server.CreateObject("MSXML2.XSLTemplate.4.0")
' If I haven't posted the form first, then load my unaltered XML.
' If I'm posting info to resort or edit, then build my XML from that.
'On Error Resume Next 'debugging code
If Request.Form("acctname") = "" Then
Call oXmlsrc.load(xmlServerHttp.responseXML) ??????
'Response.Write "<!-- " & oXmlSrc.xml & " -->" 'debugging code
newXML=oXmlsrc.xml
Set re=new regexp
re.pattern=" xmlns.+?>"
newXML=re.replace(newXML,">")
Call oXmlsrc.loadxml(newXML)
else
'Build a DOM that looks exactly like the one coming from the web service
'That way XSL can't tell the difference.
'The XML DOM is empty at this stage so we need to load it with the root node
...
if oXslsrc.load(Server.MapPath("verifyaccount.xsl")) then
Set oXslTemplate.stylesheet = oXslsrc
Set oXslProcessor = oXslTemplate.createProcessor()
oXslProcessor.input = oXmlsrc
else
Set oMailer = Server.CreateObject("Persits.MailSender")
...