Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 25817

Show HN: Swift SOAP Client library through code generation

$
0
0

README.md

Lark is a SOAP library written in Swift.

Build Status

Features

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)
}

Example

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

FAQ

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.


Viewing all articles
Browse latest Browse all 25817

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>