Hi all,

Over the past few months I've been writing a SOAP client library. It uses code generation to generated the client proxy. The major benefit of code generation is that all messages are typed and great autocompletion support. You can find the project here: https://github.com/Bouke/Lark. I'd be happy to hear your feedback / questions!

Usage instructions;

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

--
-Bouke
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to