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 = falsevar 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")
}