Using Windows scripting to access Web SERVICES

Source: Internet
Author: User
Tags http request soap web services xmlns
services|web|window| access to the ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
' Modiay by X
' 2003-12-30
'''''''''''''''''''''''''''''''''''''''''''''''
Const ForReading = 1, ForWriting = 2, ForAppending = 8 ' file operation constant
'''''''''''''''''''''''''''''''''''''''''''''''
WebServiceURL = "http://www.chefbj.net/WEBSERVICES/school.asmx" Call URL (URI)
Webmethodname = "Http://www.chefbj.com/show_school" Calls method name

' SOAP requests that need to be changed based on specific Web SERVICES Web methods
sentrequest= "<?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>" _
& "<show_school xmlns= ' http://www.chefbj.com ' >" _
& "<password>chef</password>" _
& "</show_school>" _
& "</soap:Body>" _
& "</soap:Envelope>"

responsefile= "Request.xml" answer file
'''''''''''''''''''''''''''''''''''''''''''''''

Set requesthttp = CreateObject ("Microsoft.XMLHTTP")

Requesthttp.open "POST", WebServiceURL, False

Requesthttp.setrequestheader "Content-type", "Text/xml"
Requesthttp.setrequestheader "CharSet", "Utf-8"
Requesthttp.setrequestheader "SOAPAction", Webmethodname

Requesthttp.send Sentrequest

MsgBox ("The request has been sent out.") HTTP request Status= "& Requesthttp.status)


' Log the answer into the file
Set objFSO = CreateObject ("Scripting.FileSystemObject")
Set objTextFile = objFSO.CreateTextFile (Responsefile, True,true)


objTextFile.Write (RequestHTTP.responsexml.xml)

Objtextfile.close




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.