SOAP WSDL Generate Code

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
#include <C_CkXml.h>
#include <C_CkHttp.h>
#include <C_CkHttpResponse.h>

void ChilkatSample(void)
    {
    HCkXml xml;
    const char *soapRequestBody;
    const char *endpoint;
    const char *soapAction;
    const char *contentType;
    HCkHttp http;
    HCkHttpResponse resp;
    HCkXml responseXml;
    int statusCode;
    const char *identifier;
    const char *sender;
    const char *sent;
    const char *status;
    const char *msgType;
    const char *source;
    const char *scope;
    const char *restriction;
    const char *addresses;
    const char *code;
    const char *note;
    const char *references;
    const char *incidents;
    const char *language;
    const char *category;
    const char *v_event;
    const char *responseType;
    const char *urgency;
    const char *severity;
    const char *certainty;
    const char *audience;
    const char *valueName;
    const char *value;
    const char *effective;
    const char *onset;
    const char *expires;
    const char *senderName;
    const char *headline;
    const char *description;
    const char *instruction;
    const char *web;
    const char *contact;
    const char *resourceDesc;
    const char *mimeType;
    const char *size;
    const char *uri;
    const char *derefUri;
    const char *digest;
    const char *areaDesc;
    const char *polygon;
    const char *circle;
    const char *altitude;
    const char *ceiling;

    xml = CkXml_Create();
    CkXml_putTag(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_putEmitXmlDecl(xml,FALSE);
    soapRequestBody = CkXml_getXml(xml);

    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";

    http = CkHttp_Create();

    CkHttp_ClearHeaders(http);
    CkHttp_SetRequestHeader(http,"Content-Type",contentType);
    CkHttp_SetRequestHeader(http,"SOAPAction",soapAction);

    resp = CkHttp_PostXml(http,endpoint,soapRequestBody,"utf-8");
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        printf("Failed to send SOAP request.\n");
        CkXml_Dispose(xml);
        CkHttp_Dispose(http);
        return;
    }

    // Get the XML response body.
    responseXml = CkXml_Create();
    CkHttpResponse_GetBodyXml(resp,responseXml);

    statusCode = CkHttpResponse_getStatusCode(resp);
    printf("response status code: %d\n",statusCode);

    CkHttpResponse_Dispose(resp);

    // If the status code does not indicate succcess, then show the response XML,
    // which probably contains error information.
    if (statusCode != 200) {
        printf("%s\n",CkXml_getXml(responseXml));
        CkXml_Dispose(xml);
        CkHttp_Dispose(http);
        CkXml_Dispose(responseXml);
        return;
    }

    printf("%s\n",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).

    identifier = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:identifier");
    sender = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:sender");
    sent = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:sent");
    status = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:status");
    msgType = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:msgType");
    source = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:source");
    scope = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:scope");
    restriction = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:restriction");
    addresses = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:addresses");
    code = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:code");
    note = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:note");
    references = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:references");
    incidents = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:incidents");
    language = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:language");
    category = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:category");
    v_event = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:event");
    responseType = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:responseType");
    urgency = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:urgency");
    severity = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:severity");
    certainty = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:certainty");
    audience = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:audience");
    valueName = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:valueName");
    value = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:value");
    effective = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:effective");
    onset = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:onset");
    expires = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:expires");
    senderName = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:senderName");
    headline = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:headline");
    description = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:description");
    instruction = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:instruction");
    web = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:web");
    contact = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:contact");
    valueName = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:parameter|*:valueName");
    value = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:parameter|*:value");
    resourceDesc = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:resourceDesc");
    mimeType = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:mimeType");
    size = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:size");
    uri = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:uri");
    derefUri = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:derefUri");
    digest = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:digest");
    areaDesc = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:areaDesc");
    polygon = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:polygon");
    circle = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:circle");
    valueName = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:geocode|*:valueName");
    value = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:geocode|*:value");
    altitude = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:altitude");
    ceiling = CkXml_getChildContent(responseXml,"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:ceiling");


    CkXml_Dispose(xml);
    CkHttp_Dispose(http);
    CkXml_Dispose(responseXml);

    }
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>