Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Latest commit

 

History

History
98 lines (63 loc) · 3.04 KB

README.md

File metadata and controls

98 lines (63 loc) · 3.04 KB

Lark: Swift SOAP Client

Lark is a SOAP library written in Swift.

Build Status

Features

  • Swift 4
  • Swift Package Manager
  • API Client code generation
  • Strictly typed
  • SOAP 1.1
  • SOAP document/literal (wrapped) encoding
  • Both synchronous and asynchronous

Communication

  • If you need help, open an issue.
  • If you'd like to ask a general question, open an issue.
  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Usage

First, install the package by including the following in Package.swift:

.Package(url: "https://github.com/Bouke/Lark.git", majorVersion: 0)

Then, build your package. This will result in an executable named lark-generate-client which can generate the client code:

swift build
.build/debug/lark-generate-client "http://localhost:8000/?wsdl" > Sources/Client.swift

In your code you can now use the generated Client like this:

let client = HelloWorldServiceClient()

To call a remote method, inspect the generated functions on the Client. For example the sayHello method that takes a SayHello parameter and returns a SayHelloResponse:

let result = try client.sayHello(SayHello(name: "World", times: 2))
print(result.sayHelloResult)

Or if you're building a GUI that requires non-blocking networking, use the async version:

client.sayHelloAsync(SayHello(name: "World", times: 2)) { result in
    print(result?.value.sayHelloResult)
}

More information can be found in the documentation.

Example

See the Lark-Example repository for an example of how to use Lark.

Swift Compatibility

Swift 4 is required with version 1 of this package. Use version 0 if you need Swift 3 compatibility.

FAQ

Is Linux supported?

Not yet. This library builds on various XMLDocument APIs that are either not available in Swift-Foundation (the Swift port of some Foundation APIs) or behave differently. Also a major dependency, AlamoFire, is not yet supported on iOS. To track the progress on this, subscribe to ticket 22.

Is iOS supported?

No. This library builds on various XMLDocument APIs that are not available on iOS. Switching to another XML library might help here, but I don't have the need for this. Feel free to reach out to me if you're interested in working on a pull request to change this.

Can it act as a SOAP server?

No. Feel free to reach out to me if you're interested in working on a pull request to change this.

Is CocoaPods / Carthage supported?

No.

Why is it called Lark?

SOAP is sometimes referred to as a fat messaging protocol. Swift is an elegant bird. A Lark sometimes looks like a fat bird.

Credits

This library was written by Bouke Haarsma.