Repository navigation
SOAPEngine 2.0.0-beta.1
Pre-release
Pre-release
SOAPEngine 2.0 is a rewrite in Swift, usable from Swift and Objective-C. Most 1.x calls still compile, as deprecated API whose message says what to use instead. Coming from 1.x? Read MIGRATION.md before you upgrade: some behaviour changed.
New
- watchOS support, besides iOS, macOS and tvOS.
async/await:asyncRequestURLreturns the reply,streamRequestURLgives the progress and then the reply; a cancelledTaskcancels its own request; your tests can create the result (RequestResult) and the failure (RequestError). Closures of progress, delegate and notifications keep working.- typed results:
didCompleteandsyncRequestURLalso give yourDecodabletypes,Dataor a JSONString. - Swift structs and enums as parameters, also nested in arrays and dictionaries.
SOAPExcludedParamsProtocol(SOAPExcludedParamsObjCProtocolfor Objective-C classes): a type given tosetParamlists the properties that are not sent. Without it every stored property is sent, the private ones too. A tuple, or an enum with associated values, that holds such a type is not sent.- MTOM/XOP attachments (
enableMTOM,mimeParts,mimePart(id:),didMimeParts); a request with aMIMEattachment is not sent unlessenableMTOMis on with a SOAP version, and one with aMIMEvalue in the SOAPheader, or with a line break or another control character in the headers of a part, is never sent. - a request whose SOAP action or
soapActionRequestholds a line break, another control character, a double quote or a backslash is not sent; with MTOM and SOAP 1.2 the content type and the headers of the root part carry the action that is sent (soapActionRequestincluded). - REST mode with XML replies (
version = .rest,restMethod). - WS-Security XML signature and encryption of messages, with certificate types
.sign,.encryption,.verificationand.signAndEncryption. The reply to a signed request is read only after it is verified. requiresSignatureConfirmation: only the reply that confirms the signature of its own request is accepted (WS-Security 1.1)..digest_RCF2617: Digest authentication as in RFC 2617.- one engine may run several requests at the same time;
cancelcancels all of them; an event already being delivered on another thread may still arrive. maximumReplySizestops a reply that is too long (off by default).- optional CBC mode for the AES256 encryption of values (
encryptionMode). cachePolicy,encoding, and your own queues (requestQueue,parsingQueue).
Changed since 1.x
- minimum versions: iOS 15, macOS 12, tvOS 15, watchOS 9; Xcode 26 or later (Swift 6.2) is needed.
- distributed as a Swift package only: no CocoaPods pod and no prebuilt framework. It depends on a fork of
Fuziand onHTMLSpecialCharacters: your app cannot also depend on the originalFuzi. - the default
requestTimeoutis 60 seconds (it was 20). - sync requests block the calling thread instead of running its run loop: do not call them on the main thread. A request that transfers nothing for longer than
requestTimeoutthrows a timeout error; a sync request made from a callback works, and when that callback runs onrequestQueueorparsingQueueit uses neither; a cancelled one throwsNSURLErrorCancelled. They do not replace yourdidCompleteanddidFailed. - callbacks arrive on a background thread, on
requestQueueorparsingQueue: move to the main queue before you update the user interface. - a new limit is on by default: a reply or WSDL is refused when an element has more than
maximumAttributesattributes (1000), when it has an internal DTD subset, or when its encoding is UTF-7, EBCDIC or another one not compatible with ASCII or UTF-16. - the same check also looks inside comments and CDATA, and requires a standard XML declaration, a plain document type and, for an encrypted reply, UTF-8. 0 removes these checks; for the reply to a signed request it removes only the limit on the attributes.
- closures, delegate and notifications are all called: a closure no longer replaces the delegate.
- each request keeps the settings, parameters and closures that the engine had when it started: set them before
requestURL.statusCode,response,mimePartsand the value getters change when a request ends: inside the callbacks that run while a reply is read, use their arguments. - a Swift delegate must rename
soapEngine(_:didBeforeSending:)tosoapEngine(_:didBeforeSendingURLRequest:), or it is not called. - attribute values are always escaped; a request with an invalid XML name or character, a colon in
soapNamespaceor text that the encoding cannot write is not sent, and you get an error. - without a sub-key, binary data and booleans inside arrays are sent as
base64Binaryandboolean.legacyArrayItemNamesgives the 1.x names: set it before the parameters. - user name and password answer an authentication challenge only for the host, port and scheme you called (or the same host after a redirect from
httptohttps), and a Basic challenge only overhttps. Credentials saved inURLCredentialStorageare not used. - when you set a
.pinningcertificate, the server must show exactly that one also withselfSignedon: in 1.xselfSignedcame before the pin. If your pinned certificate is out of date, the connection is now refused. - every WS-Security request has a new nonce and creation time, which the
nonceandcreatedproperties do not show. A value that you set is sent with every request, and a server may refuse the repetition. - Digest headers have quoted values (
.digestkeeps the older form without quality of protection). They use the method of the request unless you setmethod, and they are written again for the request that the before-sending hooks leave (not a header that a hook changed).countcounts the requests of onenonce: it restarts with another one, and a request with a generated nonce sends 1. - AES256: set
encryptionPasswordbefore the parameters; with a value added before it, with the password orencryptionModechanged after a value, with a value that cannot be encrypted, or with the 1.xencryptionTypeset to AES256 and no password, the request is not sent. The default format is that of 1.x (ECB); a 1.x peer cannot read CBC. - a request no longer changes your settings (
actionQuotes,actionNamespaceSlash,restMethod,retrievesAttributes), and each one sends its own SOAPAction:soapActionRequeststaysnilunless you set it. - the library prints no requests or replies: use the before-sending and before-parsing hooks to see them.
Migration from 1.x: MIGRATION.md. Add with Swift Package Manager: .package(url: "https://github.com/priore/SOAPEngine.git", exact: "2.0.0-beta.1").