<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1504.81">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333; background-color: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333; background-color: #ffffff; min-height: 18.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px 'Helvetica Neue'; color: #333333; -webkit-text-stroke: #333333; min-height: 18.0px}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.6px Consolas; color: #183691; -webkit-text-stroke: #183691; background-color: #f7f7f7}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.6px Consolas; color: #333333; -webkit-text-stroke: #333333; background-color: #f7f7f7}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.6px Consolas; color: #0086b3; -webkit-text-stroke: #0086b3; background-color: #f7f7f7}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.6px Consolas; color: #333333; -webkit-text-stroke: #333333}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #929292; min-height: 14.0px}
p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #929292}
span.s1 {font-kerning: none}
span.s2 {font: 13.6px Consolas; font-kerning: none; background-color: rgba(0, 0, 0, 0.039)}
span.s3 {font-kerning: none; color: #333333; -webkit-text-stroke: 0px #333333}
span.s4 {font-kerning: none; color: #0086b3; -webkit-text-stroke: 0px #0086b3}
span.s5 {font-kerning: none; color: #183691; -webkit-text-stroke: 0px #183691}
span.s6 {font-kerning: none; color: #a71d5d; -webkit-text-stroke: 0px #a71d5d}
span.s7 {font-kerning: none; background-color: #f7f7f7}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><span class="s1">Hi all,</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">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!</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Usage instructions;</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">First, install the package by including the following in </span><span class="s2">Package.swift</span><span class="s1">:</span></p>
<p class="p3"><span class="s1"></span><br></p>
<p class="p4"><span class="s3"><span class="Apple-tab-span">        </span>.</span><span class="s4">Package</span><span class="s3">(</span><span class="s4">url</span><span class="s3">: </span><span class="s1">"https://github.com/Bouke/Lark.git"</span><span class="s3">, </span><span class="s4">majorVersion</span><span class="s3">: </span><span class="s4">0</span><span class="s3">)</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Then, build your package. This will result in an executable named </span><span class="s2">lark-generate-client</span><span class="s1"> which can generate the client code:</span></p>
<p class="p3"><span class="s1"></span><br></p>
<p class="p5"><span class="s1"><span class="Apple-tab-span">        </span>swift build</span></p>
<p class="p5"><span class="s1"><span class="Apple-tab-span">        </span>.build/debug/lark-generate-client </span><span class="s5">"http://localhost:8000/?wsdl"</span><span class="s1"> </span><span class="s6">&gt;</span><span class="s1"> Sources/Client.swift</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">In your code you can now use the generated </span><span class="s2">Client</span><span class="s1"> like this:</span></p>
<p class="p3"><span class="s1"></span><br></p>
<p class="p6"><span class="s6"><span class="Apple-tab-span">        </span>let</span><span class="s3"> client </span><span class="s6">=</span><span class="s3"> </span><span class="s1">HelloWorldServiceClient</span><span class="s3">()</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">To call a remote method, inspect the generated functions on the Client. For example the </span><span class="s2">sayHello</span><span class="s1"> method that takes a </span><span class="s2">SayHello</span><span class="s1"> parameter and returns a </span><span class="s2">SayHelloResponse</span><span class="s1">:</span></p>
<p class="p3"><span class="s1"></span><br></p>
<p class="p5"><span class="s6"><span class="Apple-tab-span">        </span>let</span><span class="s1"> result </span><span class="s6">=</span><span class="s1"> </span><span class="s6">try</span><span class="s1"> client.</span><span class="s4">sayHello</span><span class="s1">(</span><span class="s4">SayHello</span><span class="s1">(</span><span class="s4">name</span><span class="s1">: </span><span class="s5">"World"</span><span class="s1">, </span><span class="s4">times</span><span class="s1">: </span><span class="s4">2</span><span class="s1">))</span></p>
<p class="p5"><span class="s4"><span class="Apple-tab-span">        </span>print</span><span class="s1">(result.sayHelloResult)</span></p>
<p class="p2"><span class="s1"></span><br></p>
<p class="p1"><span class="s1">Or if you're building a GUI that requires non-blocking networking, use the async version:</span></p>
<p class="p3"><span class="s1"></span><br></p>
<p class="p6"><span class="s3"><span class="Apple-tab-span">        </span>client.</span><span class="s1">sayHelloAsync</span><span class="s3">(</span><span class="s1">SayHello</span><span class="s3">(</span><span class="s1">name</span><span class="s3">: </span><span class="s5">"World"</span><span class="s3">, </span><span class="s1">times</span><span class="s3">: </span><span class="s1">2</span><span class="s3">)) { result </span><span class="s6">in</span></p>
<p class="p5"><span class="s1"><span class="Apple-tab-span">        </span><span class="Apple-converted-space">    </span></span><span class="s4">print</span><span class="s1">(result</span><span class="s6">?</span><span class="s1">.</span><span class="s4">value</span><span class="s1">.sayHelloResult)</span></p>
<p class="p7"><span class="s7"><span class="Apple-tab-span">        </span>}</span></p>
<p class="p8"><br></p>
<p class="p9">--<span class="Apple-converted-space"> </span></p>
<p class="p9">-Bouke</p>
</body>
</html>