namespace Test.ServiceModel
open System
open System.IO
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations
[<AllowNullLiteral>]
type Poco() =
member val Name:String = null with get,set
[<AllowNullLiteral>]
type TestUploadWithDto() =
interface IPost
member val Int:Int32 = new Int32() with get,set
member val NullableId:Nullable<Int32> = new Nullable<Int32>() with get,set
member val Long:Int64 = new Int64() with get,set
member val Double:Double = new Double() with get,set
member val String:String = null with get,set
member val DateTime:DateTime = new DateTime() with get,set
member val IntArray:Int32[] = null with get,set
member val IntList:ResizeArray<Int32> = null with get,set
member val StringArray:String[] = null with get,set
member val StringList:ResizeArray<String> = null with get,set
member val PocoArray:Poco[] = null with get,set
member val PocoList:ResizeArray<Poco> = null with get,set
member val NullableByteArray:Nullable<Byte> = null with get,set
member val NullableByteList:ResizeArray<Nullable<Byte>> = null with get,set
member val NullableDateTimeArray:Nullable<DateTime> = null with get,set
member val NullableDateTimeList:ResizeArray<Nullable<DateTime>> = null with get,set
member val PocoLookup:Dictionary<String, List<Poco>> = null with get,set
member val PocoLookupMap:Dictionary<String, List<Dictionary<String,Poco>>> = null with get,set
member val MapList:Dictionary<String, List<String>> = null with get,set
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsv/reply/TestUploadWithDto HTTP/1.1
Host: test.servicestack.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
int: 0,
nullableId: 0,
long: 0,
double: 0,
string: String,
dateTime: 0001-01-01,
intArray:
[
0
],
intList:
[
0
],
stringArray:
[
String
],
stringList:
[
String
],
pocoArray:
[
{
name: String
}
],
pocoList:
[
{
name: String
}
],
nullableByteArray:
[
0
],
nullableByteList:
[
0
],
nullableDateTimeArray:
[
0001-01-01
],
nullableDateTimeList:
[
0001-01-01
],
pocoLookup:
{
String:
[
{
name: String
}
]
},
pocoLookupMap:
{
String:
[
{
String:
{
name: String
}
}
]
},
mapList:
{
String:
[
String
]
}
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { int: 0, nullableId: 0, long: 0, double: 0, string: String, dateTime: 0001-01-01, intArray: [ 0 ], intList: [ 0 ], stringArray: [ String ], stringList: [ String ], pocoArray: [ { name: String } ], pocoList: [ { name: String } ], nullableByteArray: [ 0 ], nullableByteList: [ 0 ], nullableDateTimeArray: [ 0001-01-01 ], nullableDateTimeList: [ 0001-01-01 ], pocoLookup: { String: [ { name: String } ] }, pocoLookupMap: { String: [ { String: { name: String } } ] }, mapList: { String: [ String ] } }