mboost-dp1
Hjælp til SOAP via classic ASP
- Forside
- ⟨
- Forum
- ⟨
- Programmering
Hej.
Jeg har brug for at sende sådan en SOAP envelope for at modtage noget XML. Dybest set interesserer jeg mig ikke for SOAP, og håber egentlig på at nogen kan hjælpe mig med at finde ud af hvorfor mit script (i bunden af denne post) giver en server-side fejl:
----------------------------------------
Data at the root level is invalid. Line 1, position 39.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.XmlException: Data at the root level is invalid. Line 1, position 39.
Source Error:
Line 85: {
Line 86:
Line 87: dom.Load(httpStream);
Line 88:
Line 89: // Reset the stream position.
--------------------------------------------
... og mit script:
<%
soup="<?xml version=""1.0"" encoding=""utf-8""?>"""&vbcrlf&_
"<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">"&vbcrlf&_
" <soap12:Header>"&vbcrlf&_
" <Authentication xmlns=""http://v2.services.trade.xdev.dk/"">"&vbcrlf&_
" <User>(mit username)</User>"&vbcrlf&_
" <Password>(mit password)</Password>"&vbcrlf&_
" </Authentication>"&vbcrlf&_
" </soap12:Header>"&vbcrlf&_
" <soap12:Body>"&vbcrlf&_
" <GetAllProductInfos xmlns=""http://v2.services.trade.xdev.dk/"" />"&vbcrlf&_
" </soap12:Body>"&vbcrlf&_
"</soap12:Envelope>"
set objHTTP=server.createobject("Msxml2.ServerXMLHTTP.3.0")
'set objHTTP=server.createobject("MSSOAP.HttpConnector30")
objHTTP.open "POST", "http://eshop.rosenmeier.dk/Services/ProductInfoService.asmx",false
'objHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8;"
objHTTP.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8;"
objHTTP.setRequestHeader "SOAPAction", "http://v2.services.trade.xdev.dk/GetAllProductInfos"
objHTTP.setRequestHeader "Content-length", len(soup)
objHTTP.send soup
if objHTTP.status<>200 then
response.write "ERROR: " & objHTTP.responsetext
response.end
end if
response.write "SVAR:<br>"
response.write objHTTP.responseBody
set objhttp=nothing
%>
Jeg har brug for at sende sådan en SOAP envelope for at modtage noget XML. Dybest set interesserer jeg mig ikke for SOAP, og håber egentlig på at nogen kan hjælpe mig med at finde ud af hvorfor mit script (i bunden af denne post) giver en server-side fejl:
----------------------------------------
Data at the root level is invalid. Line 1, position 39.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.XmlException: Data at the root level is invalid. Line 1, position 39.
Source Error:
Line 85: {
Line 86:
Line 87: dom.Load(httpStream);
Line 88:
Line 89: // Reset the stream position.
--------------------------------------------
... og mit script:
<%
soup="<?xml version=""1.0"" encoding=""utf-8""?>"""&vbcrlf&_
"<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">"&vbcrlf&_
" <soap12:Header>"&vbcrlf&_
" <Authentication xmlns=""http://v2.services.trade.xdev.dk/"">"&vbcrlf&_
" <User>(mit username)</User>"&vbcrlf&_
" <Password>(mit password)</Password>"&vbcrlf&_
" </Authentication>"&vbcrlf&_
" </soap12:Header>"&vbcrlf&_
" <soap12:Body>"&vbcrlf&_
" <GetAllProductInfos xmlns=""http://v2.services.trade.xdev.dk/"" />"&vbcrlf&_
" </soap12:Body>"&vbcrlf&_
"</soap12:Envelope>"
set objHTTP=server.createobject("Msxml2.ServerXMLHTTP.3.0")
'set objHTTP=server.createobject("MSSOAP.HttpConnector30")
objHTTP.open "POST", "http://eshop.rosenmeier.dk/Services/ProductInfoService.asmx",false
'objHTTP.setRequestHeader "Content-Type", "text/xml; charset=utf-8;"
objHTTP.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8;"
objHTTP.setRequestHeader "SOAPAction", "http://v2.services.trade.xdev.dk/GetAllProductInfos"
objHTTP.setRequestHeader "Content-length", len(soup)
objHTTP.send soup
if objHTTP.status<>200 then
response.write "ERROR: " & objHTTP.responsetext
response.end
end if
response.write "SVAR:<br>"
response.write objHTTP.responseBody
set objhttp=nothing
%>
Gå til top
Opret dig som bruger i dag
Det er gratis, og du binder dig ikke til noget.
Når du er oprettet som bruger, får du adgang til en lang række af sidens andre muligheder, såsom at udforme siden efter eget ønske og deltage i diskussionerne.