How to send and receive XML data using ASP

Source: Internet
Author: User

This method is used because of some interfaces of mobile dream WAP. The ASP.net version is available next. This is an ASP version, and MSXML2.XMLHTTP is used.
Request. asp

The following is a reference clip:
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
123456 987654
11111 22222"
If Https. readystate = 4 then
Response. write "submitted successfully"
'Readstate reading status is 4, and the operation is successful. If the reading status is not successful, you do not need to proceed.
Dim objstream
Set objstream = Server. CreateObject ("adodb. stream ")
'Define a stream. You have to deal with it because it is garbled.
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 images.
Objstream. Close
Set objstream = nothing
Set https = nothing
End if
Response. write html
Response. asp
'Create a 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 & "<br> Line:" & xml. parseError. Line
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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.