SOAP WSDL Generate Code

SpringCMServiceSoap12 / SetPermission

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:spr", value: "http://www.springcm.com/atlas/webservices/v201308/scm/")
    xml.UpdateChildContent("soap:Header", value: "")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:token", value: "string")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:ObjectId", value: "string")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:ObjectType", value: "Document")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:Write", value: "Deny")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:Read", value: "Deny")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:Move", value: "Deny")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:Create", value: "Deny")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:SetAccess", value: "Deny")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:ApplyToUserName", value: "string")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:ApplyToUserId", value: "string")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:ApplyToRole", value: "Primary")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:ApplyToGroupId", value: "string")
    xml.UpdateChildContent("soap:Body|spr:SetPermission|spr:permissions|spr:Permission|spr:ApplyToGroupName", 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://soapna11.springcm.com/atlas/webservices/v201308/springcmservice.asmx"
    var soapAction: String? = "http://www.springcm.com/atlas/webservices/v201308/scm/SetPermission"
    //  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 ObjectId: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:ObjectId")
    var ObjectType: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:ObjectType")
    var Write: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:Write")
    var Read: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:Read")
    var Move: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:Move")
    var Create: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:Create")
    var SetAccess: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:SetAccess")
    var ApplyToUserName: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:ApplyToUserName")
    var ApplyToUserId: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:ApplyToUserId")
    var ApplyToRole: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:ApplyToRole")
    var ApplyToGroupId: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:ApplyToGroupId")
    var ApplyToGroupName: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:ErrorObject|*:ApplyToGroupName")
    var Message: String? = responseXml.GetChildContent("*:Body|*:SetPermissionResponse|*:SetPermissionResult|*:SetPermissionResult|*:Message")

}
Request XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spr="http://www.springcm.com/atlas/webservices/v201308/scm/">
    <soap:Header/>
    <soap:Body>
        <spr:SetPermission>
            <spr:token>string</spr:token>
            <spr:permissions>
                <spr:Permission>
                    <spr:ObjectId>string</spr:ObjectId>
                    <spr:ObjectType>Document</spr:ObjectType>
                    <spr:Write>Deny</spr:Write>
                    <spr:Read>Deny</spr:Read>
                    <spr:Move>Deny</spr:Move>
                    <spr:Create>Deny</spr:Create>
                    <spr:SetAccess>Deny</spr:SetAccess>
                    <spr:ApplyToUserName>string</spr:ApplyToUserName>
                    <spr:ApplyToUserId>string</spr:ApplyToUserId>
                    <spr:ApplyToRole>Primary</spr:ApplyToRole>
                    <spr:ApplyToGroupId>string</spr:ApplyToGroupId>
                    <spr:ApplyToGroupName>string</spr:ApplyToGroupName>
                </spr:Permission>
            </spr:permissions>
        </spr:SetPermission>
    </soap:Body>
</soap:Envelope>
Response XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:spr="http://www.springcm.com/atlas/webservices/v201308/scm/">
    <soap:Header/>
    <soap:Body>
        <spr:SetPermissionResponse>
            <spr:SetPermissionResult>
                <spr:SetPermissionResult>
                    <spr:ErrorObject>
                        <spr:ObjectId>string</spr:ObjectId>
                        <spr:ObjectType>Document</spr:ObjectType>
                        <spr:Write>Deny</spr:Write>
                        <spr:Read>Deny</spr:Read>
                        <spr:Move>Deny</spr:Move>
                        <spr:Create>Deny</spr:Create>
                        <spr:SetAccess>Deny</spr:SetAccess>
                        <spr:ApplyToUserName>string</spr:ApplyToUserName>
                        <spr:ApplyToUserId>string</spr:ApplyToUserId>
                        <spr:ApplyToRole>Primary</spr:ApplyToRole>
                        <spr:ApplyToGroupId>string</spr:ApplyToGroupId>
                        <spr:ApplyToGroupName>string</spr:ApplyToGroupName>
                    </spr:ErrorObject>
                    <spr:Message>string</spr:Message>
                </spr:SetPermissionResult>
            </spr:SetPermissionResult>
        </spr:SetPermissionResponse>
    </soap:Body>
</soap:Envelope>