ASP calls WebService)

Source: Internet
Author: User

First, send the request and then process the response. I directly access WebService written in. NET and click the method name to view the instance code. I only need to use Microsoft. XMLHTTP in ASP to send the request, and then process the XML result.

Note that the namespace cannot be written incorrectly.

<% @ Language = VBScript codePage = 936%>
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
</Head>
<Body>
<%
Dim strxml
Dim Str

'Define a SOAP message
Strxml = "<? XML version = '1. 0' encoding = 'utf-8'?> "
Strxml = strxml & "<soap: envelope xmlns: xsi = 'HTTP: // your xmlns: XSD = 'HTTP: // www.w3.org/2001/xmlschema' xmlns: Soap = 'HTTP: // schemas.xmlsoap.org/soap/envelope/'>"
Strxml = strxml & "<soap: Body>"
Strxml = strxml & "<decrypt xmlns = 'HTTP: // 192.168.3.239: 8000/3 des/'>"
Strxml = strxml & "<strin> 4dv5esfhah0 = </strin>"
Strxml = strxml & "<strkey> not. cente </strkey>"
Strxml = strxml & "</decrypt>"
Strxml = strxml & "</soap: Body>"
Strxml = strxml & "</soap: envelope>"

Set H = Createobject ("Microsoft. XMLHTTP ")
'Send post message to the specified URL
H. Open "Post", "http: // 192.168.3.239: 8000/3 des/service. asmx", false
H. setRequestHeader "Content-Type", "text/XML; charset = UTF-8"
H. setRequestHeader "Content-Length", Len (strxml)
H. setRequestHeader "soapaction", "http: // 192.168.3.239: 8000/3 des/decrypt"
H. Send (strxml)

'Display returned XML Information

If H. Status = 200 then
Set xmldoc = server. Createobject ("MSXML. domdocument ")
Xmldoc. Load (H. responsexml)
STR = xmldoc. childnodes (1). text'' call showallnode

'Traverse and retrieve a node in XML
Set node = xmldoc. getelementsbytagname ("regionid ")
'For x = node. Length-1 to 0 step-1
Regmgrid = node. Item (0). Text
'Next

Set xmldoc = nothing
Response. Write (STR)
Else
Response. Write H. Status & "& nbsp ;"
Response. Write H. statustext
End if

%>
</Body>
</Html>

 

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.