SOAP WSDL Generate Code

CAPSoapHttp / getRequest

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
func chilkatTest() {
    let xml = CkoXml()!
    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:getRequestTypeDef|req:requestAPI", value: "string")
    xml.updateChildContent("soapenv:Body|WL5G3N1:getRequestTypeDef|req:requestOperation", value: "string")
    xml.updateChildContent("soapenv:Body|WL5G3N1:getRequestTypeDef|req:parameters|req:parameterName", value: "string")
    xml.updateChildContent("soapenv:Body|WL5G3N1:getRequestTypeDef|req:parameters|req:comparisonOp", value: "string")
    xml.updateChildContent("soapenv:Body|WL5G3N1:getRequestTypeDef|req:parameters|req:parameterValue", value: "string")
    xml.updateChildContent("soapenv:Body|WL5G3N1:getRequestTypeDef|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 = false
    var soapRequestBody: String? = xml.getXml()

    var endpoint: String? = "http://tdl.integration.aws.fema.gov/IPAWS_CAPService/IPAWS"
    var soapAction: String? = "http://gov.fema.ipaws.services/IPAWS_CAPService/getRequest"
    //  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
    var contentType: String? = "text/xml"

    let http = CkoHttp()!

    http.clearHeaders()
    http.setRequestHeader("Content-Type", value: contentType)
    http.setRequestHeader("SOAPAction", value: soapAction)

    let resp = CkoHttpResponse()!
ERROR: Undefined variable(success)

ERROR: Undefined variable(success)
    if success == false {
        print("\(http.lastErrorText!)")
        print("Failed to send SOAP request.")
        return
    }

    // Get the XML response body.
    let responseXml = CkoXml()!
    resp.getBody(responseXml)

    var statusCode: Int = resp.statusCode.intValue
    print("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 {
        print("\(responseXml.getXml()!)")
        return
    }

    print("\(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).

    var parameterName: String? = responseXml.getChildContent("*:Body|*:getResponseTypeDef|*:parameterListItem|*:parameterName")
    var parameterValue: String? = responseXml.getChildContent("*:Body|*:getResponseTypeDef|*:parameterListItem|*:parameterValue")
    var subParameterName: String? = responseXml.getChildContent("*:Body|*:getResponseTypeDef|*:parameterListItem|*:subParaListItem|*:subParameterName")
    var subParameterValue: String? = responseXml.getChildContent("*:Body|*:getResponseTypeDef|*:parameterListItem|*:subParaListItem|*:subParameterValue")
    var ResponseOperation: String? = responseXml.getChildContent("*:Body|*:getResponseTypeDef|*:ResponseOperation")
    var ResponseType: String? = responseXml.getChildContent("*:Body|*:getResponseTypeDef|*:ResponseType")

}
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:getRequestTypeDef>
            <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:getRequestTypeDef>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:resp="http://gov.fema.ipaws.services/capresponse" xmlns:WL5G3N1="http://gov.fema.ipaws.services/IPAWS_CAPService/" xmlns:capresp="http://gov.fema.ipaws.services/capresponse">
    <soapenv:Header/>
    <soapenv:Body>
        <WL5G3N1:getResponseTypeDef>
            <resp:parameterListItem>
                <resp:parameterName>string</resp:parameterName>
                <resp:parameterValue>string</resp:parameterValue>
                <resp:subParaListItem>
                    <resp:subParameterName>string</resp:subParameterName>
                    <resp:subParameterValue>string</resp:subParameterValue>
                </resp:subParaListItem>
            </resp:parameterListItem>
            <resp:ResponseOperation>string</resp:ResponseOperation>
            <resp:ResponseType>string</resp:ResponseType>
        </WL5G3N1:getResponseTypeDef>
    </soapenv:Body>
</soapenv:Envelope>