You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
without messy configuration and generated code mandated by other options.
668
673
</p>
669
674
675
+
<aname="calling"></a>
676
+
<h2>Calling Web Services from Code</h2>
677
+
<p>
678
+
Using DTOs to define your web service interface makes it possible to provide strong-typed generic service clients without any code-gen or extra build-steps,
679
+
leading to a productive end-to-end type-safe communication gateway from client to server.
680
+
</p>
681
+
<p>
682
+
C#/.NET Clients can call the above Hello Service using any of the
683
+
<ahref="https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Common/ServiceClient.Web/">JSON, JSV, XML or SOAP Service Clients</a>
684
+
with the code below:
685
+
</p>
686
+
687
+
<codeclass="csharp">var response = client.Send<HelloResponse>(new Hello { Name = "World!" });
688
+
Console.WriteLine(response.Result); // => Hello, World
689
+
</code>
690
+
<h4>Async Example</h4>
691
+
<codeclass="csharp">client.SendAsync<HelloResponse>(new Hello { Name = "World!" },
692
+
r => Console.WriteLine(r.Result), (r, ex) => { throw ex; });
693
+
</code>
694
+
695
+
<p>
696
+
The Service Clients use the automatic <ahref="#predefinedroutes">Pre-Defined Routes above</a>.
697
+
</p>
698
+
<p>
699
+
In addition, the Service Clients also provide HTTP Verbs (Get, Post & PostFile, Put, Delete) letting you call custom user-defined routes REST-fully e.g:
r => Console.WriteLine(r.Result), (r, ex) => { throw ex; });
708
+
</code>
709
+
710
+
<h3>MonoTouch</h3>
711
+
<p>
712
+
Due to iOS's <ahref="http://docs.xamarin.com/ios/about/limitations">No-JIT restrictions</a>, MonoTouch apps will need to use these
713
+
<ahref="https://github.com/ServiceStack/ServiceStack/tree/master/release/latest/MonoTouch">custom builds of ServiceStack's Serializers and Service Clients</a>.
714
+
</p>
715
+
716
+
<h3>JavaScript</h3>
717
+
<p>
718
+
As ServiceStack returns 'clean responses' (i.e. your Serialized DTOs as-is), it can easily be called with other existing Http or Ajax clients, e.g. using jQuery:
0 commit comments