CAPSoapHttp / getMessage
ASP AutoIt C C (Unicode) C++ C++ (Unicode) C# DataFlex Delphi Foxpro Go Java Node.js Objective-C Perl PHP Extension PowerBuilder Powershell PureBasic Python CkPython Ruby SQL Server Swift TCL VB.NET VB6 VBScript Xojo
Use ChilkatAx-9.5.0-win32.pkg
Procedure Test
Handle hoXml
Boolean iSuccess
String sSoapRequestBody
String sEndpoint
String sSoapAction
String sContentType
Handle hoHttp
Variant vResp
Handle hoResp
Variant vResponseXml
Handle hoResponseXml
Integer iStatusCode
String sIdentifier
String sSender
String sSent
String sStatus
String sMsgType
String sSource
String sScope
String sRestriction
String sAddresses
String sCode
String sNote
String sReferences
String sIncidents
String sLanguage
String sCategory
String sV_event
String sResponseType
String sUrgency
String sSeverity
String sCertainty
String sAudience
String sValueName
String sValue
String sEffective
String sOnset
String sExpires
String sSenderName
String sHeadline
String sDescription
String sInstruction
String sWeb
String sContact
String sResourceDesc
String sMimeType
String sSize
String sUri
String sDerefUri
String sDigest
String sAreaDesc
String sPolygon
String sCircle
String sAltitude
String sCeiling
String sTemp1
Boolean bTemp1
Get Create (RefClass(cComChilkatXml)) To hoXml
If (Not(IsComObjectCreated(hoXml))) Begin
Send CreateComObject of hoXml
End
Set ComTag Of hoXml To "soapenv:Envelope"
Get ComAddAttribute Of hoXml "xmlns:soapenv" "http://schemas.xmlsoap.org/soap/envelope/" To iSuccess
Get ComAddAttribute Of hoXml "xmlns:req" "http://gov.fema.ipaws.services/caprequest" To iSuccess
Get ComAddAttribute Of hoXml "xmlns:WL5G3N1" "http://gov.fema.ipaws.services/IPAWS_CAPService/" To iSuccess
Get ComAddAttribute Of hoXml "xmlns:capreq" "http://gov.fema.ipaws.services/caprequest" To iSuccess
Send ComUpdateChildContent To hoXml "soapenv:Header|WL5G3N1:request_Header|WL5G3N1:logonUser" "xml"
Send ComUpdateChildContent To hoXml "soapenv:Header|WL5G3N1:request_Header|WL5G3N1:logonCogId" "xml"
Send ComUpdateChildContent To hoXml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:requestAPI" "string"
Send ComUpdateChildContent To hoXml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:requestOperation" "string"
Send ComUpdateChildContent To hoXml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:parameterName" "string"
Send ComUpdateChildContent To hoXml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:comparisonOp" "string"
Send ComUpdateChildContent To hoXml "soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:parameterValue" "string"
Send ComUpdateChildContent To hoXml "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.
Set ComEmitXmlDecl Of hoXml To False
Get ComGetXml Of hoXml To sSoapRequestBody
Move "http://tdl.integration.aws.fema.gov/IPAWS_CAPService/IPAWS" To sEndpoint
Move "http://gov.fema.ipaws.services/IPAWS_CAPService/getMessage" To sSoapAction
// For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
Move "text/xml" To sContentType
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Send ComClearHeaders To hoHttp
Send ComSetRequestHeader To hoHttp "Content-Type" sContentType
Send ComSetRequestHeader To hoHttp "SOAPAction" sSoapAction
Get ComPostXml Of hoHttp sEndpoint sSoapRequestBody "utf-8" To vResp
If (IsComObject(vResp)) Begin
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
Set pvComObject Of hoResp To vResp
End
Get ComLastMethodSuccess Of hoHttp To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Showln "Failed to send SOAP request."
Procedure_Return
End
// Get the XML response body.
Get Create (RefClass(cComChilkatXml)) To hoResponseXml
If (Not(IsComObjectCreated(hoResponseXml))) Begin
Send CreateComObject of hoResponseXml
End
Get pvComObject of hoResponseXml to vResponseXml
Get ComGetBodyXml Of hoResp vResponseXml To iSuccess
Get ComStatusCode Of hoResp To iStatusCode
Showln "response status code: " iStatusCode
Send Destroy of hoResp
// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.
If (iStatusCode <> 200) Begin
Get ComGetXml Of hoResponseXml To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComGetXml Of hoResponseXml To sTemp1
Showln sTemp1
// 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).
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:identifier" To sIdentifier
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:sender" To sSender
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:sent" To sSent
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:status" To sStatus
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:msgType" To sMsgType
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:source" To sSource
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:scope" To sScope
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:restriction" To sRestriction
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:addresses" To sAddresses
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:code" To sCode
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:note" To sNote
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:references" To sReferences
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:incidents" To sIncidents
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:language" To sLanguage
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:category" To sCategory
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:event" To sV_event
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:responseType" To sResponseType
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:urgency" To sUrgency
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:severity" To sSeverity
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:certainty" To sCertainty
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:audience" To sAudience
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:valueName" To sValueName
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:value" To sValue
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:effective" To sEffective
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:onset" To sOnset
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:expires" To sExpires
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:senderName" To sSenderName
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:headline" To sHeadline
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:description" To sDescription
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:instruction" To sInstruction
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:web" To sWeb
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:contact" To sContact
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:parameter|*:valueName" To sValueName
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:parameter|*:value" To sValue
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:resourceDesc" To sResourceDesc
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:mimeType" To sMimeType
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:size" To sSize
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:uri" To sUri
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:derefUri" To sDerefUri
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:digest" To sDigest
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:areaDesc" To sAreaDesc
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:polygon" To sPolygon
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:circle" To sCircle
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:geocode|*:valueName" To sValueName
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:geocode|*:value" To sValue
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:altitude" To sAltitude
Get ComGetChildContent Of hoResponseXml "*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:ceiling" To sCeiling
End_Procedure
Request XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://gov.fema.ipaws.services/caprequest" xmlns:WL5G3N1="http://gov.fema.ipaws.services/IPAWS_CAPService/" xmlns:capreq="http://gov.fema.ipaws.services/caprequest">
<soapenv:Header>
<WL5G3N1:request_Header>
<WL5G3N1:logonUser>xml</WL5G3N1:logonUser>
<WL5G3N1:logonCogId>xml</WL5G3N1:logonCogId>
</WL5G3N1:request_Header>
</soapenv:Header>
<soapenv:Body>
<WL5G3N1:getMessageTypeDef>
<req:requestAPI>string</req:requestAPI>
<req:requestOperation>string</req:requestOperation>
<req:parameters>
<req:parameterName>string</req:parameterName>
<req:comparisonOp>string</req:comparisonOp>
<req:parameterValue>string</req:parameterValue>
<req:logicalOp>string</req:logicalOp>
</req:parameters>
</WL5G3N1:getMessageTypeDef>
</soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:WL5G3N1="http://gov.fema.ipaws.services/IPAWS_CAPService/" xmlns:cap="urn:oasis:names:tc:emergency:cap:1.2">
<soapenv:Header/>
<soapenv:Body>
<WL5G3N1:messageResponseTypeDef>
<cap:alert>
<cap:identifier>xml</cap:identifier>
<cap:sender>xml</cap:sender>
<cap:sent>dateTime</cap:sent>
<cap:status>Actual</cap:status>
<cap:msgType>Alert</cap:msgType>
<cap:source>xml</cap:source>
<cap:scope>Public</cap:scope>
<cap:restriction>xml</cap:restriction>
<cap:addresses>xml</cap:addresses>
<cap:code>xml</cap:code>
<cap:note>xml</cap:note>
<cap:references>xml</cap:references>
<cap:incidents>xml</cap:incidents>
<cap:info>
<cap:language>xml</cap:language>
<cap:category>Geo</cap:category>
<cap:event>xml</cap:event>
<cap:responseType>Shelter</cap:responseType>
<cap:urgency>Immediate</cap:urgency>
<cap:severity>Extreme</cap:severity>
<cap:certainty>Observed</cap:certainty>
<cap:audience>xml</cap:audience>
<cap:eventCode>
<cap:valueName>xml</cap:valueName>
<cap:value>xml</cap:value>
</cap:eventCode>
<cap:effective>dateTime</cap:effective>
<cap:onset>dateTime</cap:onset>
<cap:expires>dateTime</cap:expires>
<cap:senderName>xml</cap:senderName>
<cap:headline>xml</cap:headline>
<cap:description>xml</cap:description>
<cap:instruction>xml</cap:instruction>
<cap:web>xml</cap:web>
<cap:contact>xml</cap:contact>
<cap:parameter>
<cap:valueName>xml</cap:valueName>
<cap:value>xml</cap:value>
</cap:parameter>
<cap:resource>
<cap:resourceDesc>xml</cap:resourceDesc>
<cap:mimeType>xml</cap:mimeType>
<cap:size>xml</cap:size>
<cap:uri>xml</cap:uri>
<cap:derefUri>xml</cap:derefUri>
<cap:digest>xml</cap:digest>
</cap:resource>
<cap:area>
<cap:areaDesc>xml</cap:areaDesc>
<cap:polygon>xml</cap:polygon>
<cap:circle>xml</cap:circle>
<cap:geocode>
<cap:valueName>xml</cap:valueName>
<cap:value>xml</cap:value>
</cap:geocode>
<cap:altitude>xml</cap:altitude>
<cap:ceiling>xml</cap:ceiling>
</cap:area>
</cap:info>
</cap:alert>
</WL5G3N1:messageResponseTypeDef>
</soapenv:Body>
</soapenv:Envelope>