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)
}
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.
Lark: Swift SOAP Client
Lark is a SOAP library written in Swift.
Features
Communication
Usage
First, install the package by including the following in
Package.swift
:Then, build your package. This will result in an executable named
lark-generate-client
which can generate the client code:In your code you can now use the generated
Client
like this:To call a remote method, inspect the generated functions on the Client. For example the
sayHello
method that takes aSayHello
parameter and returns aSayHelloResponse
:Or if you’re building a GUI that requires non-blocking networking, use the async version:
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.