SOAP WSDL Generate Code

ServiceSoap12 / GestioneAppartamenti_FileUnico_Test

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 = "soap:Envelope"
    xml.AddAttribute("xmlns:soap", value: "http://www.w3.org/2003/05/soap-envelope")
    xml.AddAttribute("xmlns:all", value: "AlloggiatiService")
    xml.UpdateChildContent("soap:Header", value: "")
    xml.UpdateChildContent("soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:Utente", value: "string")
    xml.UpdateChildContent("soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:token", value: "string")
    xml.UpdateChildContent("soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:ElencoSchedine|all:string", value: "string")
    xml.UpdateChildContentInt("soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:SchedineValide", value: 1042)
    xml.UpdateChildContent("soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:Dettaglio|all:EsitoOperazioneServizio|all:esito", value: "true")
    xml.UpdateChildContent("soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:Dettaglio|all:EsitoOperazioneServizio|all:ErroreCod", value: "string")
    xml.UpdateChildContent("soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:Dettaglio|all:EsitoOperazioneServizio|all:ErroreDes", value: "string")
    xml.UpdateChildContent("soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:Dettaglio|all:EsitoOperazioneServizio|all:ErroreDettaglio", 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? = "https://alloggiatiweb.poliziadistato.it/service/service.asmx"
    var soapAction: String? = "AlloggiatiService/GestioneAppartamenti_FileUnico_Test"
    //  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)

    var resp: CkoHttpResponse? = http.PostXml(endpoint, xmlDoc: soapRequestBody, charset: "utf-8")
    if http.LastMethodSuccess == false {
        print("\(http.LastErrorText)")
        print("Failed to send SOAP request.")
        return
    }

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

    var statusCode: Int = resp!.StatusCode.intValue
    print("response status code: \(statusCode)")

    resp = nil

    // 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 esito: String? = responseXml.GetChildContent("*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:GestioneAppartamenti_FileUnico_TestResult|*:esito")
    var ErroreCod: String? = responseXml.GetChildContent("*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:GestioneAppartamenti_FileUnico_TestResult|*:ErroreCod")
    var ErroreDes: String? = responseXml.GetChildContent("*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:GestioneAppartamenti_FileUnico_TestResult|*:ErroreDes")
    var ErroreDettaglio: String? = responseXml.GetChildContent("*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:GestioneAppartamenti_FileUnico_TestResult|*:ErroreDettaglio")
    var SchedineValide: Int = responseXml.GetChildIntValue("*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:SchedineValide").intValue
    esito = responseXml.GetChildContent("*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:Dettaglio|*:EsitoOperazioneServizio|*:esito")
    ErroreCod = responseXml.GetChildContent("*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:Dettaglio|*:EsitoOperazioneServizio|*:ErroreCod")
    ErroreDes = responseXml.GetChildContent("*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:Dettaglio|*:EsitoOperazioneServizio|*:ErroreDes")
    ErroreDettaglio = responseXml.GetChildContent("*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:Dettaglio|*:EsitoOperazioneServizio|*:ErroreDettaglio")

}
Request XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:all="AlloggiatiService">
    <soap:Header/>
    <soap:Body>
        <all:GestioneAppartamenti_FileUnico_Test>
            <all:Utente>string</all:Utente>
            <all:token>string</all:token>
            <all:ElencoSchedine>
                <all:string>string</all:string>
            </all:ElencoSchedine>
            <all:result>
                <all:SchedineValide>1042</all:SchedineValide>
                <all:Dettaglio>
                    <all:EsitoOperazioneServizio>
                        <all:esito>true</all:esito>
                        <all:ErroreCod>string</all:ErroreCod>
                        <all:ErroreDes>string</all:ErroreDes>
                        <all:ErroreDettaglio>string</all:ErroreDettaglio>
                    </all:EsitoOperazioneServizio>
                </all:Dettaglio>
            </all:result>
        </all:GestioneAppartamenti_FileUnico_Test>
    </soap:Body>
</soap:Envelope>
Response XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:all="AlloggiatiService">
    <soap:Header/>
    <soap:Body>
        <all:GestioneAppartamenti_FileUnico_TestResponse>
            <all:GestioneAppartamenti_FileUnico_TestResult>
                <all:esito>true</all:esito>
                <all:ErroreCod>string</all:ErroreCod>
                <all:ErroreDes>string</all:ErroreDes>
                <all:ErroreDettaglio>string</all:ErroreDettaglio>
            </all:GestioneAppartamenti_FileUnico_TestResult>
            <all:result>
                <all:SchedineValide>1042</all:SchedineValide>
                <all:Dettaglio>
                    <all:EsitoOperazioneServizio>
                        <all:esito>true</all:esito>
                        <all:ErroreCod>string</all:ErroreCod>
                        <all:ErroreDes>string</all:ErroreDes>
                        <all:ErroreDettaglio>string</all:ErroreDettaglio>
                    </all:EsitoOperazioneServizio>
                </all:Dettaglio>
            </all:result>
        </all:GestioneAppartamenti_FileUnico_TestResponse>
    </soap:Body>
</soap:Envelope>