Skip to content

SOAPEngine 2.0.0-beta.1

Pre-release
Pre-release

Choose a tag to compare

@priore priore released this 02 Dec 19:14
· 1 commit to beta/2.0 since this 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: asyncRequestURL returns the reply, streamRequestURL gives the progress and then the reply; a cancelled Task cancels its own request; your tests can create the result (RequestResult) and the failure (RequestError). Closures of progress, delegate and notifications keep working.
  • typed results: didComplete and syncRequestURL also give your Decodable types, Data or a JSON String.
  • Swift structs and enums as parameters, also nested in arrays and dictionaries.
  • SOAPExcludedParamsProtocol (SOAPExcludedParamsObjCProtocol for Objective-C classes): a type given to setParam lists 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 a MIME attachment is not sent unless enableMTOM is on with a SOAP version, and one with a MIME value in the SOAP header, or with a line break or another control character in the headers of a part, is never sent.
  • a request whose SOAP action or soapActionRequest holds 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 (soapActionRequest included).
  • REST mode with XML replies (version = .rest, restMethod).
  • WS-Security XML signature and encryption of messages, with certificate types .sign, .encryption, .verification and .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; cancel cancels all of them; an event already being delivered on another thread may still arrive.
  • maximumReplySize stops 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 Fuzi and on HTMLSpecialCharacters: your app cannot also depend on the original Fuzi.
  • the default requestTimeout is 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 requestTimeout throws a timeout error; a sync request made from a callback works, and when that callback runs on requestQueue or parsingQueue it uses neither; a cancelled one throws NSURLErrorCancelled. They do not replace your didComplete and didFailed.
  • callbacks arrive on a background thread, on requestQueue or parsingQueue: 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 maximumAttributes attributes (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, mimeParts and 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:) to soapEngine(_:didBeforeSendingURLRequest:), or it is not called.
  • attribute values are always escaped; a request with an invalid XML name or character, a colon in soapNamespace or 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 base64Binary and boolean. legacyArrayItemNames gives 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 http to https), and a Basic challenge only over https. Credentials saved in URLCredentialStorage are not used.
  • when you set a .pinning certificate, the server must show exactly that one also with selfSigned on: in 1.x selfSigned came 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 nonce and created properties 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 (.digest keeps the older form without quality of protection). They use the method of the request unless you set method, and they are written again for the request that the before-sending hooks leave (not a header that a hook changed). count counts the requests of one nonce: it restarts with another one, and a request with a generated nonce sends 1.
  • AES256: set encryptionPassword before the parameters; with a value added before it, with the password or encryptionMode changed after a value, with a value that cannot be encrypted, or with the 1.x encryptionType set 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: soapActionRequest stays nil unless 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").