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 com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    CkXml xml = new CkXml();
    xml.put_Tag("soapenv:Envelope");
    xml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/");
    xml.AddAttribute("xmlns:req","http://gov.fema.ipaws.services/caprequest");
    xml.AddAttribute("xmlns:WL5G3N1","http://gov.fema.ipaws.services/IPAWS_CAPService/");
    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.put_EmitXmlDecl(false);
    String soapRequestBody = xml.getXml();

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

    CkHttp http = new CkHttp();

    http.ClearHeaders();
    http.SetRequestHeader("Content-Type",contentType);
    http.SetRequestHeader("SOAPAction",soapAction);

    CkHttpResponse resp = http.PostXml(endpoint,soapRequestBody,"utf-8");
    if (http.get_LastMethodSuccess() == false) {
        System.out.println(http.lastErrorText());
        System.out.println("Failed to send SOAP request.");
        return;
        }

    // Get the XML response body.
    CkXml responseXml = new CkXml();
    resp.GetBodyXml(responseXml);

    int statusCode = resp.get_StatusCode();
    System.out.println("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) {
        System.out.println(responseXml.getXml());
        return;
        }

    System.out.println(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).

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