MyApp

<back to all web services

HelloAllTypes

# frozen_string_literal: true
# encoding: utf-8


require 'json'
require 'servicestack'


class SubType
    include ServiceStack::DTO

    # @return [Integer]
    attr_accessor :id
    # @return [String]
    attr_accessor :name

    def self.properties
        {
            id: { name: 'id' },
            name: { name: 'name' },
        }
    end

end

class AllTypes
    include ServiceStack::DTO

    # @return [Integer]
    attr_accessor :id
    # @return [Integer]
    attr_accessor :nullable_id
    # @return [Integer]
    attr_accessor :byte
    # @return [Integer]
    attr_accessor :short
    # @return [Integer]
    attr_accessor :int
    # @return [Integer]
    attr_accessor :long
    # @return [Integer]
    attr_accessor :u_short
    # @return [Integer]
    attr_accessor :u_int
    # @return [Integer]
    attr_accessor :u_long
    # @return [Float]
    attr_accessor :float
    # @return [Float]
    attr_accessor :double
    # @return [BigDecimal]
    attr_accessor :decimal
    # @return [String]
    attr_accessor :string
    # @return [DateTime]
    attr_accessor :date_time
    # @return [Time]
    attr_accessor :time_span
    # @return [DateTime]
    attr_accessor :date_time_offset
    # @return [String]
    attr_accessor :guid
    # @return [String]
    attr_accessor :char
    # @return [KeyValuePair]
    attr_accessor :key_value_pair
    # @return [DateTime]
    attr_accessor :nullable_date_time
    # @return [Time]
    attr_accessor :nullable_time_span
    # @return [List]
    attr_accessor :string_list
    # @return [Array]
    attr_accessor :string_array
    # @return [Dictionary]
    attr_accessor :string_map
    # @return [Dictionary]
    attr_accessor :int_string_map
    # @return [SubType]
    attr_accessor :sub_type
    # @return [Point]
    attr_accessor :point
    # @DataMember(Name="aliasedName")
    # @return [String]
    attr_accessor :original_name

    def self.properties
        {
            id: { name: 'id' },
            nullable_id: { name: 'nullableId' },
            byte: { name: 'byte' },
            short: { name: 'short' },
            int: { name: 'int' },
            long: { name: 'long' },
            u_short: { name: 'uShort' },
            u_int: { name: 'uInt' },
            u_long: { name: 'uLong' },
            float: { name: 'float' },
            double: { name: 'double' },
            decimal: { name: 'decimal' },
            string: { name: 'string' },
            date_time: { name: 'dateTime', type: DateTime },
            time_span: { name: 'timeSpan' },
            date_time_offset: { name: 'dateTimeOffset', type: DateTime },
            guid: { name: 'guid' },
            char: { name: 'char' },
            key_value_pair: { name: 'keyValuePair' },
            nullable_date_time: { name: 'nullableDateTime', type: DateTime },
            nullable_time_span: { name: 'nullableTimeSpan' },
            string_list: { name: 'stringList' },
            string_array: { name: 'stringArray' },
            string_map: { name: 'stringMap' },
            int_string_map: { name: 'intStringMap' },
            sub_type: { name: 'subType', type: SubType },
            point: { name: 'point' },
            original_name: { name: 'aliasedName' },
        }
    end

    def response_type() = AllTypes
    def get_type_name() = 'AllTypes'
end

class Poco
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :name

    def self.properties
        {
            name: { name: 'name' },
        }
    end

end

class AllCollectionTypes
    include ServiceStack::DTO

    # @return [Array]
    attr_accessor :int_array
    # @return [List]
    attr_accessor :int_list
    # @return [Array]
    attr_accessor :string_array
    # @return [List]
    attr_accessor :string_list
    # @return [Array]
    attr_accessor :poco_array
    # @return [List]
    attr_accessor :poco_list
    # @return [Array]
    attr_accessor :nullable_byte_array
    # @return [List]
    attr_accessor :nullable_byte_list
    # @return [Array]
    attr_accessor :nullable_date_time_array
    # @return [List]
    attr_accessor :nullable_date_time_list
    # @return [Dictionary]
    attr_accessor :poco_lookup
    # @return [Dictionary]
    attr_accessor :poco_lookup_map

    def self.properties
        {
            int_array: { name: 'intArray' },
            int_list: { name: 'intList' },
            string_array: { name: 'stringArray' },
            string_list: { name: 'stringList' },
            poco_array: { name: 'pocoArray', type: [Poco] },
            poco_list: { name: 'pocoList', type: [Poco] },
            nullable_byte_array: { name: 'nullableByteArray' },
            nullable_byte_list: { name: 'nullableByteList' },
            nullable_date_time_array: { name: 'nullableDateTimeArray' },
            nullable_date_time_list: { name: 'nullableDateTimeList' },
            poco_lookup: { name: 'pocoLookup' },
            poco_lookup_map: { name: 'pocoLookupMap' },
        }
    end

end

class HelloAllTypesResponse
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :result
    # @return [AllTypes]
    attr_accessor :all_types
    # @return [AllCollectionTypes]
    attr_accessor :all_collection_types

    def self.properties
        {
            result: { name: 'result' },
            all_types: { name: 'allTypes', type: AllTypes },
            all_collection_types: { name: 'allCollectionTypes', type: AllCollectionTypes },
        }
    end

end

class HelloAllTypes
    include ServiceStack::DTO

    # @return [String]
    attr_accessor :name
    # @return [AllTypes]
    attr_accessor :all_types
    # @return [AllCollectionTypes]
    attr_accessor :all_collection_types

    def self.properties
        {
            name: { name: 'name' },
            all_types: { name: 'allTypes', type: AllTypes },
            all_collection_types: { name: 'allCollectionTypes', type: AllCollectionTypes },
        }
    end

    def response_type() = HelloAllTypesResponse
    def get_type_name() = 'HelloAllTypes'
end

Ruby HelloAllTypes DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /xml/reply/HelloAllTypes HTTP/1.1 
Host: blazor-gallery.servicestack.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<HelloAllTypes xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApp.ServiceModel">
  <AllCollectionTypes>
    <IntArray xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:int>0</d3p1:int>
    </IntArray>
    <IntList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:int>0</d3p1:int>
    </IntList>
    <NullableByteArray xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:unsignedByte>0</d3p1:unsignedByte>
    </NullableByteArray>
    <NullableByteList xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:unsignedByte>0</d3p1:unsignedByte>
    </NullableByteList>
    <NullableDateTimeArray xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:dateTime>0001-01-01T00:00:00</d3p1:dateTime>
    </NullableDateTimeArray>
    <NullableDateTimeList xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:dateTime>0001-01-01T00:00:00</d3p1:dateTime>
    </NullableDateTimeList>
    <PocoArray>
      <Poco>
        <Name>String</Name>
      </Poco>
    </PocoArray>
    <PocoList>
      <Poco>
        <Name>String</Name>
      </Poco>
    </PocoList>
    <PocoLookup xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringArrayOfPocoB8fmgb81>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>
          <Poco>
            <Name>String</Name>
          </Poco>
        </d3p1:Value>
      </d3p1:KeyValueOfstringArrayOfPocoB8fmgb81>
    </PocoLookup>
    <PocoLookupMap xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringArrayOfArrayOfKeyValueOfstringPocoB8fmgb81ty7Ep6D1>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>
          <d3p1:ArrayOfKeyValueOfstringPocoB8fmgb81>
            <d3p1:KeyValueOfstringPocoB8fmgb81>
              <d3p1:Key>String</d3p1:Key>
              <d3p1:Value>
                <Name>String</Name>
              </d3p1:Value>
            </d3p1:KeyValueOfstringPocoB8fmgb81>
          </d3p1:ArrayOfKeyValueOfstringPocoB8fmgb81>
        </d3p1:Value>
      </d3p1:KeyValueOfstringArrayOfArrayOfKeyValueOfstringPocoB8fmgb81ty7Ep6D1>
    </PocoLookupMap>
    <StringArray xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </StringArray>
    <StringList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </StringList>
  </AllCollectionTypes>
  <AllTypes>
    <Byte>0</Byte>
    <Char>0</Char>
    <DateTime>0001-01-01T00:00:00</DateTime>
    <DateTimeOffset xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:DateTime>0001-01-01T00:00:00Z</d3p1:DateTime>
      <d3p1:OffsetMinutes>0</d3p1:OffsetMinutes>
    </DateTimeOffset>
    <Decimal>0</Decimal>
    <Double>0</Double>
    <Float>0</Float>
    <Guid>00000000-0000-0000-0000-000000000000</Guid>
    <Id>0</Id>
    <Int>0</Int>
    <IntStringMap xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfintstring>
        <d3p1:Key>0</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfintstring>
    </IntStringMap>
    <KeyValuePair xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
      <d3p1:key>String</d3p1:key>
      <d3p1:value>String</d3p1:value>
    </KeyValuePair>
    <Long>0</Long>
    <NullableDateTime>0001-01-01T00:00:00</NullableDateTime>
    <NullableId>0</NullableId>
    <NullableTimeSpan>PT0S</NullableTimeSpan>
    <OriginalName>String</OriginalName>
    <Point>
      <X>0</X>
      <Y>0</Y>
    </Point>
    <Short>0</Short>
    <String>String</String>
    <StringArray xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </StringArray>
    <StringList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </StringList>
    <StringMap xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </StringMap>
    <SubType>
      <Id>0</Id>
      <Name>String</Name>
    </SubType>
    <TimeSpan>PT0S</TimeSpan>
    <UInt>0</UInt>
    <ULong>0</ULong>
    <UShort>0</UShort>
  </AllTypes>
  <Name>String</Name>
</HelloAllTypes>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<HelloAllTypesResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApp.ServiceModel">
  <AllCollectionTypes>
    <IntArray xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:int>0</d3p1:int>
    </IntArray>
    <IntList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:int>0</d3p1:int>
    </IntList>
    <NullableByteArray xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:unsignedByte>0</d3p1:unsignedByte>
    </NullableByteArray>
    <NullableByteList xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:unsignedByte>0</d3p1:unsignedByte>
    </NullableByteList>
    <NullableDateTimeArray xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:dateTime>0001-01-01T00:00:00</d3p1:dateTime>
    </NullableDateTimeArray>
    <NullableDateTimeList xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:dateTime>0001-01-01T00:00:00</d3p1:dateTime>
    </NullableDateTimeList>
    <PocoArray>
      <Poco>
        <Name>String</Name>
      </Poco>
    </PocoArray>
    <PocoList>
      <Poco>
        <Name>String</Name>
      </Poco>
    </PocoList>
    <PocoLookup xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringArrayOfPocoB8fmgb81>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>
          <Poco>
            <Name>String</Name>
          </Poco>
        </d3p1:Value>
      </d3p1:KeyValueOfstringArrayOfPocoB8fmgb81>
    </PocoLookup>
    <PocoLookupMap xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringArrayOfArrayOfKeyValueOfstringPocoB8fmgb81ty7Ep6D1>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>
          <d3p1:ArrayOfKeyValueOfstringPocoB8fmgb81>
            <d3p1:KeyValueOfstringPocoB8fmgb81>
              <d3p1:Key>String</d3p1:Key>
              <d3p1:Value>
                <Name>String</Name>
              </d3p1:Value>
            </d3p1:KeyValueOfstringPocoB8fmgb81>
          </d3p1:ArrayOfKeyValueOfstringPocoB8fmgb81>
        </d3p1:Value>
      </d3p1:KeyValueOfstringArrayOfArrayOfKeyValueOfstringPocoB8fmgb81ty7Ep6D1>
    </PocoLookupMap>
    <StringArray xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </StringArray>
    <StringList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </StringList>
  </AllCollectionTypes>
  <AllTypes>
    <Byte>0</Byte>
    <Char>0</Char>
    <DateTime>0001-01-01T00:00:00</DateTime>
    <DateTimeOffset xmlns:d3p1="http://schemas.datacontract.org/2004/07/System">
      <d3p1:DateTime>0001-01-01T00:00:00Z</d3p1:DateTime>
      <d3p1:OffsetMinutes>0</d3p1:OffsetMinutes>
    </DateTimeOffset>
    <Decimal>0</Decimal>
    <Double>0</Double>
    <Float>0</Float>
    <Guid>00000000-0000-0000-0000-000000000000</Guid>
    <Id>0</Id>
    <Int>0</Int>
    <IntStringMap xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfintstring>
        <d3p1:Key>0</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfintstring>
    </IntStringMap>
    <KeyValuePair xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
      <d3p1:key>String</d3p1:key>
      <d3p1:value>String</d3p1:value>
    </KeyValuePair>
    <Long>0</Long>
    <NullableDateTime>0001-01-01T00:00:00</NullableDateTime>
    <NullableId>0</NullableId>
    <NullableTimeSpan>PT0S</NullableTimeSpan>
    <OriginalName>String</OriginalName>
    <Point>
      <X>0</X>
      <Y>0</Y>
    </Point>
    <Short>0</Short>
    <String>String</String>
    <StringArray xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </StringArray>
    <StringList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </StringList>
    <StringMap xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </StringMap>
    <SubType>
      <Id>0</Id>
      <Name>String</Name>
    </SubType>
    <TimeSpan>PT0S</TimeSpan>
    <UInt>0</UInt>
    <ULong>0</ULong>
    <UShort>0</UShort>
  </AllTypes>
  <Result>String</Result>
</HelloAllTypesResponse>