Standard example for ASP to call. net WebService

Source: Internet
Author: User

 

 

When you open the WebService address, you can see that you must note the different aspects of SOAP in versions 1.1 and 1.2. Errors are generally found in these areas.

The demo address is valid for 30 days from the date of publication.

Http://api.510769.com/Service.asmx? Op = AandB

 

Release Version (some brothers say they cannot directly use the application. In fact, the application is very simple)

<% Url = "HTTP: // api.52.1669.com/Service. asmx" SoapRequest = "<? Xml version = "" 1.0 "" encoding = "" UTF-8 ""?> "& _" <Soap: Envelope xmlns: xsi = "" http://www.w3.org/2001/XMLSchema-instance "" xmlns: xsd = "" http://www.w3.org/2001/XMLSchema "" xmlns: soap = "" http://schemas.xmlsoap.org/soap/envelope/ ">" & _ "<soap: Body>" & _ "<AandB xmlns =" "HTTP: // api.52.1669.com/""> "& _" <a> 1 </a> "& _" <B> 2 </B> "& _" </AandB>" & _ "</soap: body> "& _" </soap: Envelope> "Set xmlDOC = Server. createObject ("MSXML. DOMDocument ") Set xmlhttp = server. createObject ("Msxml2.XMLHTTP") xmlhttp. open "POST", url, Falsexmlhttp. setRequestHeader "Content-Type", "text/xml; charset = UTF-8" xmlhttp. setRequestHeader "Content-Length", LEN (SoapRequest) xmlhttp. setRequestHeader "Host", "api.52.1669.com" xmlhttp. setRequestHeader "SOAPAction", "HTTP: // api.52.1669.com/AandB" xmlhttp. send (SoapRequest) bOK = xmlDOC. load (xmlhttp. responseXML) xmlStr = xmlDOC. xmlSet ReStr=xmlDOC.doc umentElement. selectNodes ("// AandBResult") ', which directly calls Response. write (bOK & xmlStr & ReStr (0 ). text) If 'bok is fasle, Set ReStr = NothingSet xmlhttp = Nothing Set xmlDOC = Nothing %>

 

Code

 <%
Dim url = "HTTP: // api.52.1669.com/Service. asmx"

Dim SoapRequest = "<? Xml version = "" 1.0 "" encoding = "" UTF-8 ""?> "&_
"<Soap: Envelope xmlns: xsi =" "http://www.w3.org/2001/XMLSchema-instance" "xmlns: xsd =" "http://www.w3.org/2001/XMLSchema" "xmlns: soap =" "http://schemas.xmlsoap.org/soap/envelope/"> "&_
"<Soap: Body> "&_
"<AandB xmlns = ""HTTP: // api.52.1669.com/""> "&_
"<A> 1 </a> "&_
"<B> 2 </B> "&_
"</AandB> "&_
"</Soap: Body> "&_
"</Soap: Envelope>"


Set xmlDOC = Server. CreateObject ("MSXML. DOMDocument ")
Set xmlhttp = server. CreateObject ("Msxml2.XMLHTTP ")
Xmlhttp. Open "POST", url, False
Xmlhttp. setRequestHeader "Content-Type ","Text/xml; charset = UTF-8"
Xmlhttp. setRequestHeader "Content-Length", LEN (SoapRequest)
Xmlhttp. setRequestHeader "Host ","Api.52.1669.com"
Xmlhttp. setRequestHeader "SOAPAction ","HTTP: // api.52.1669.com/AandB"
Xmlhttp. Send (SoapRequest)

BOK = xmlDOC. load (xmlhttp. responseXML)
XmlStr = xmlDOC. xml
Response. Write (bOK & xmlStr) 'bok is fasle.

Set xmlhttp = Nothing
Set xmlDOC = Nothing
%>

 

 

 

 

 

 

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.