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
#import <CkoXml.h>
#import <NSString.h>
#import <CkoHttp.h>
#import <CkoHttpResponse.h>

CkoXml *xml = [[CkoXml alloc] init];
xml.Tag = @"soapenv:Envelope";
[xml AddAttribute: @"xmlns:soapenv" value: @"http://schemas.xmlsoap.org/soap/envelope/"];
[xml AddAttribute: @"xmlns:req" value: @"http://gov.fema.ipaws.services/caprequest"];
[xml AddAttribute: @"xmlns:WL5G3N1" value: @"http://gov.fema.ipaws.services/IPAWS_CAPService/"];
[xml AddAttribute: @"xmlns:capreq" value: @"http://gov.fema.ipaws.services/caprequest"];
[xml UpdateChildContent: @"soapenv:Header|WL5G3N1:request_Header|WL5G3N1:logonUser" value: @"xml"];
[xml UpdateChildContent: @"soapenv:Header|WL5G3N1:request_Header|WL5G3N1:logonCogId" value: @"xml"];
[xml UpdateChildContent: @"soapenv:Body|WL5G3N1:getMessageTypeDef|req:requestAPI" value: @"string"];
[xml UpdateChildContent: @"soapenv:Body|WL5G3N1:getMessageTypeDef|req:requestOperation" value: @"string"];
[xml UpdateChildContent: @"soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:parameterName" value: @"string"];
[xml UpdateChildContent: @"soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:comparisonOp" value: @"string"];
[xml UpdateChildContent: @"soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:parameterValue" value: @"string"];
[xml UpdateChildContent: @"soapenv:Body|WL5G3N1:getMessageTypeDef|req:parameters|req:logicalOp" value: @"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 = NO;
NSString *soapRequestBody = [xml GetXml];

NSString *endpoint = @"http://tdl.integration.aws.fema.gov/IPAWS_CAPService/IPAWS";
NSString *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"
NSString *contentType = @"text/xml";

CkoHttp *http = [[CkoHttp alloc] init];

[http ClearHeaders];
[http SetRequestHeader: @"Content-Type" value: contentType];
[http SetRequestHeader: @"SOAPAction" value: soapAction];

CkoHttpResponse *resp = [http PostXml: endpoint xmlDoc: soapRequestBody charset: @"utf-8"];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    NSLog(@"%@",@"Failed to send SOAP request.");
    return;
}

// Get the XML response body.
CkoXml *responseXml = [[CkoXml alloc] init];
[resp GetBodyXml: responseXml];

int statusCode = [resp.StatusCode intValue];
NSLog(@"%@%d",@"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) {
    NSLog(@"%@",[responseXml GetXml]);
    return;
}

NSLog(@"%@",[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).

NSString *identifier = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:identifier"];
NSString *sender = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:sender"];
NSString *sent = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:sent"];
NSString *status = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:status"];
NSString *msgType = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:msgType"];
NSString *source = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:source"];
NSString *scope = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:scope"];
NSString *restriction = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:restriction"];
NSString *addresses = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:addresses"];
NSString *code = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:code"];
NSString *note = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:note"];
NSString *references = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:references"];
NSString *incidents = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:incidents"];
NSString *language = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:language"];
NSString *category = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:category"];
NSString *v_event = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:event"];
NSString *responseType = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:responseType"];
NSString *urgency = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:urgency"];
NSString *severity = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:severity"];
NSString *certainty = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:certainty"];
NSString *audience = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:audience"];
NSString *valueName = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:valueName"];
NSString *value = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:eventCode|*:value"];
NSString *effective = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:effective"];
NSString *onset = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:onset"];
NSString *expires = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:expires"];
NSString *senderName = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:senderName"];
NSString *headline = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:headline"];
NSString *description = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:description"];
NSString *instruction = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:instruction"];
NSString *web = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:web"];
NSString *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"];
NSString *resourceDesc = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:resourceDesc"];
NSString *mimeType = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:mimeType"];
NSString *size = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:size"];
NSString *uri = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:uri"];
NSString *derefUri = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:derefUri"];
NSString *digest = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:resource|*:digest"];
NSString *areaDesc = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:areaDesc"];
NSString *polygon = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:polygon"];
NSString *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"];
NSString *altitude = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:altitude"];
NSString *ceiling = [responseXml GetChildContent: @"*:Body|*:messageResponseTypeDef|*:alert|*:info|*:area|*:ceiling"];
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>