VBScript calls Web Service

Source: Internet
Author: User

<! Doctype HTML public "-// W 3c // Dtd html 4.0 transitional // en ">

<HTML>

<Head>

<Title> </title>

<Meta name = "generator" content = "Microsoft Visual Studio. NET 7.1">

<Meta name = progid content = visualstudio. html>

<Meta name = originator content = "Microsoft Visual Studio. NET 7.1">

</Head>

<Body>

 

<Script language = "VBScript">

'VbCallWeb Server

Set objhttp = Createobject ("msxml2.xmlhttp ")

Set xmldoc = Createobject ("MSXML. domdocument ")

Strwebserviceurl = "http: // localhost/study/WebService. asmx/Add"

'Set parameters and their values

Strrequest = "A = 2 & B = 3"

Objhttp. Open "Post", strwebserviceurl, false

'Set thisContent-TypeImportant

Objhttp. setRequestHeader "Content-Type", "application/X-WWW-form-urlencoded"

Objhttp. Send (strrequest)

Bok = xmldoc. Load (objhttp. responsexml)

'Check the status value

// Msgbox objhttp. Status

// Msgbox objhttp. statustext

'Objhttp. Status = 200,Here we can process the returnedXMLFragment

' If you need , Can replace the returned XML In the string & Lt; And & Gt;

Xmlstr = xmldoc. xml

Xmlstr = Replace (xmlstr, "& lt;", "<", 1,-1, 1)

Xmlstr = Replace (xmlstr, "& gt;", ">", 1,-1, 1)

'Obtain results

'Obtain results using regular expressions

Set Re = new Regexp

Re. pattern = "<(. *) (. *)> (. *) <\/\ 1>"

Re. Global = true

Re. ignorecase = true

Re. multiline = true

 

Xmlstr = Re. Replace (xmlstr, "$3 ")

Re. pattern = "<?. *?> "

Xmlstr = Re. Replace (xmlstr ,"")

'Display result

Msgbox xmlstr

</SCRIPT>

</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.