Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.Set outFile = fso.CreateTextFile("output.txt", True, True)
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Xml")set xml = CreateObject("Chilkat.Xml")
xml.Tag = "soapenv:Envelope"
success = xml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
success = xml.AddAttribute("xmlns:req","http://gov.fema.ipaws.services/caprequest")
success = xml.AddAttribute("xmlns:WL5G3N1","http://gov.fema.ipaws.services/IPAWS_CAPService/")
success = xml.AddAttribute("xmlns:capreq","http://gov.fema.ipaws.services/caprequest")
xml.UpdateChildContent"soapenv:Header|WL5G3N1:request_Header|WL5G3N1:logonUser","xml"
xml.UpdateChildContent"soapenv:Header|WL5G3N1:request_Header|WL5G3N1:logonCogId","xml"
xml.UpdateChildContent"soapenv:Body|WL5G3N1:getMessageTypeDef|req:requestAPI","string"
xml.UpdateChildContent"soapenv:Body|WL5G3N1:getMessageTypeDef|req:requestOperation","string"
xml.UpdateChildContent"soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:parameterName","string"
xml.UpdateChildContent"soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:comparisonOp","string"
xml.UpdateChildContent"soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:parameterValue","string"
xml.UpdateChildContent"soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:logicalOp","string"' In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required.
xml.EmitXmlDecl = 0
soapRequestBody = xml.GetXml()
endpoint = "http://tdl.integration.aws.fema.gov/IPAWS_CAPService/IPAWS"
soapAction = "http://gov.fema.ipaws.services/IPAWS_CAPService/getMessage"' For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
contentType = "text/xml"' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Http")set http = CreateObject("Chilkat.Http")
http.ClearHeaders
http.SetRequestHeader"Content-Type",contentType
http.SetRequestHeader"SOAPAction",soapAction
' resp is a Chilkat.HttpResponse
Set resp = http.PostXml(endpoint,soapRequestBody,"utf-8")
If (http.LastMethodSuccess = 0) Then
outFile.WriteLine(http.LastErrorText)
outFile.WriteLine("Failed to send SOAP request.")
WScript.Quit
End If' Get the XML response body.' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Xml")set responseXml = CreateObject("Chilkat.Xml")
success = resp.GetBodyXml(responseXml)
statusCode = resp.StatusCode
outFile.WriteLine("response status code: " & statusCode)
' If the status code does not indicate succcess, then show the response XML,
' which probably contains error information.If (statusCode <> 200) Then
outFile.WriteLine(responseXml.GetXml())
WScript.Quit
End If
outFile.WriteLine(responseXml.GetXml())
' Parse the successful SOAP response XML.' This is a sample of the response XML, but the namespace prefixes will be different.
' We can parse the result using "*" for the namespace prefixes (see below).
identifier = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:identifier")
sender = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:sender")
sent = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:sent")
status = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:status")
msgType = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:msgType")
source = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:source")
scope = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:scope")
restriction = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:restriction")
addresses = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:addresses")
code = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:code")
note = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:note")
references = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:references")
incidents = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:incidents")
language = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:language")
category = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:category")
v_event = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:event")
responseType = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:responseType")
urgency = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:urgency")
severity = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:severity")
certainty = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:certainty")
audience = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:audience")
valueName = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:valueName")
value = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:value")
effective = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:effective")
onset = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:onset")
expires = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:expires")
senderName = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:senderName")
headline = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:headline")
description = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:description")
instruction = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:instruction")
web = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:web")
contact = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:contact")
valueName = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:parameter|*:valueName")
value = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:parameter|*:value")
resourceDesc = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:resourceDesc")
mimeType = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:mimeType")
size = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:size")
uri = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:uri")
derefUri = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:derefUri")
digest = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:digest")
areaDesc = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:areaDesc")
polygon = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:polygon")
circle = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:circle")
valueName = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:geocode|*:valueName")
value = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:geocode|*:value")
altitude = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:altitude")
ceiling = responseXml.GetChildContent("*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:ceiling")
outFile.Close