load ./chilkat.dll
set xml [new_CkXml]
CkXml_put_Tag $xml "soapenv:Envelope"CkXml_AddAttribute $xml "xmlns:soapenv""http://schemas.xmlsoap.org/soap/envelope/"CkXml_AddAttribute $xml "xmlns:req""http://gov.fema.ipaws.services/caprequest"CkXml_AddAttribute $xml "xmlns:WL5G3N1""http://gov.fema.ipaws.services/IPAWS_CAPService/"CkXml_AddAttribute $xml "xmlns:capreq""http://gov.fema.ipaws.services/caprequest"CkXml_UpdateChildContent $xml "soapenv:Header|WL5G3N1:request_Header|WL5G3N1:logonUser""xml"CkXml_UpdateChildContent $xml "soapenv:Header|WL5G3N1:request_Header|WL5G3N1:logonCogId""xml"CkXml_UpdateChildContent $xml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:requestAPI""string"CkXml_UpdateChildContent $xml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:requestOperation""string"CkXml_UpdateChildContent $xml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:parameterName""string"CkXml_UpdateChildContent $xml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:comparisonOp""string"CkXml_UpdateChildContent $xml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:parameterValue""string"CkXml_UpdateChildContent $xml "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. CkXml_put_EmitXmlDecl $xml 0set soapRequestBody [CkXml_getXml $xml]
set endpoint "http://tdl.integration.aws.fema.gov/IPAWS_CAPService/IPAWS"set 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"set contentType "text/xml"
set http [new_CkHttp]
CkHttp_ClearHeaders $http
CkHttp_SetRequestHeader $http "Content-Type" $contentType
CkHttp_SetRequestHeader $http "SOAPAction" $soapAction
# resp is a CkHttpResponseset resp [CkHttp_PostXml $http $endpoint $soapRequestBody "utf-8"]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
puts [CkHttp_lastErrorText $http]
puts "Failed to send SOAP request."
delete_CkXml $xml
delete_CkHttp $http
exit
}
# Get the XML response body.
set responseXml [new_CkXml]
CkHttpResponse_GetBodyXml $resp $responseXml
set statusCode [CkHttpResponse_get_StatusCode $resp]
puts "response status code: $statusCode"
delete_CkHttpResponse $resp
# If the status code does not indicate succcess, then show the response XML,
# which probably contains error information.if {$statusCode != 200} then {
puts [CkXml_getXml $responseXml]
delete_CkXml $xml
delete_CkHttp $http
delete_CkXml $responseXml
exit
}
puts [CkXml_getXml $responseXml]
# 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).set identifier [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:identifier"]
set sender [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:sender"]
set sent [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:sent"]
set status [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:status"]
set msgType [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:msgType"]
set source [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:source"]
set scope [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:scope"]
set restriction [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:restriction"]
set addresses [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:addresses"]
set code [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:code"]
set note [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:note"]
set references [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:references"]
set incidents [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:incidents"]
set language [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:language"]
set category [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:category"]
set v_event [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:event"]
set responseType [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:responseType"]
set urgency [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:urgency"]
set severity [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:severity"]
set certainty [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:certainty"]
set audience [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:audience"]
set valueName [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:valueName"]
set value [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:value"]
set effective [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:effective"]
set onset [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:onset"]
set expires [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:expires"]
set senderName [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:senderName"]
set headline [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:headline"]
set description [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:description"]
set instruction [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:instruction"]
set web [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:web"]
set contact [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:contact"]
set valueName [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:parameter|*:valueName"]
set value [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:parameter|*:value"]
set resourceDesc [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:resourceDesc"]
set mimeType [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:mimeType"]
set size [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:size"]
set uri [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:uri"]
set derefUri [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:derefUri"]
set digest [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:digest"]
set areaDesc [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:areaDesc"]
set polygon [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:polygon"]
set circle [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:circle"]
set valueName [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:geocode|*:valueName"]
set value [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:geocode|*:value"]
set altitude [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:altitude"]
set ceiling [CkXml_getChildContent $responseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:ceiling"]
delete_CkXml $xml
delete_CkHttp $http
delete_CkXml $responseXml