Home > Web Front-end > JS Tutorial > Processing methods and codes for sending and receiving XML data using ASP_javascript skills

Processing methods and codes for sending and receiving XML data using ASP_javascript skills

WBOY
Release: 2016-05-16 19:07:55
Original
1173 people have browsed it

Because we need to make some interfaces for Montnets WAP, we need to use this method. Next, there will be an ASP.net version. This is the ASP version, using the MSXML2.XMLHTTP object.
request.asp

Copy code The code is as follows:

dim Https
set Https=server.createobject("MSXML2.XMLHTTP")
'Define an XMLHTTP object
Https.open "POST","http://127.0.0.1/testpost/response. asp",false
Https.send "echo
< ;command_data_block>123456987654 t;
"
if Https.readystate=4 then
response.write "Submission successful"
'If the readstate reading status is 4, it is successful. Continue to the next step. If it is unsuccessful, of course there is no need to continue processing.
dim objstream
set objstream = Server.CreateObject("adodb.stream")
'Define a stream, because the read and taken out directly will be garbled, so you have to deal with it
objstream. Type = 1
objstream.Mode =3
objstream.Open
objstream.Write Https.responseBody
objstream.Position = 0
objstream.Type = 2
objstream.Charset = " GB2312"
html = objstream.ReadText
'Convert the code and put it in html to close these objects
objstream.Close
set objstream = nothing
set https=nothing
end if
response.write html

response.asp

'Create DOMDocument object
Set xml = Server.CreateObject ("msxml2.DOMDocument")
xml .async = False

'Load POST data
xml.Load Request
If xml.parseError.errorCode <> 0 Then
response.write "Cannot receive data correctly" & " Description: " & xml.parseError.reason & "
End If

set blogchild=xml.getElementsByTagName("misc_command")
'the_text =blogchild.item(0).childnodes(1).text
'the_text=blogchild.item(0).text
'for i=0 to blogchild.length-1
response.write the_text   🎜>

Using this method, it is very easy to call Servlet or Web Service in ASP!
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template