ASP calls Web Services

Source: Internet
Author: User
Code
1 function callwebservices (Surl, smethodname, soapmessage, xmlstring)
2 callwebservices = false
3
4 set XMLHTTP = Createobject ("msxml2.xmlhttp ")
5 XMLHTTP. Open "Post", Surl, false
6 XMLHTTP. setRequestHeader "Content-Type", "text/XML; charset = UTF-8"
7 XMLHTTP. setRequestHeader "soapaction", Surl & "/" & smethodname
8 XMLHTTP. Send (soapmessage)
9 'response. Write ("XMLHTTP. Status:" & XMLHTTP. Status & "<br> ")
10 'response. Write ("XMLHTTP. statustext:" & XMLHTTP. statustext & "<br> ")
11 'response. Write ("XMLHTTP. responsetext:" & XMLHTTP. responsetext & "<br> ")
12 'response. Write ("XMLHTTP. responsexml. xml:" & XMLHTTP. responsexml. xml & "<br> ")
13 if XMLHTTP. Status = 200 then
14 callwebservices = true
15 xmlstring = XMLHTTP. responsexml. xml
16 end if
17 set XMLHTTP = nothing
18 end Function

This method requires the construction of a SOAP request string.
Calling Web Services in C # is much easier. As long as you add a web reference, you can use it like using your own class.

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.