Set data format with WSMedia
It is important to set the correct MIME type for a Web service request or response. You can specify the data format via the WSMedia attribute.
The default MIME type for records and arrays in the message
response or request is JSON (application/json
). If you do not set the MIME
type with the WSMedia attribute,
the response or request will be in JSON.
WSMedia
can contain a comma-separated list of MIME types. If you
specify more than one type, the Accept header received from the client determines the payload format
chosen.
For an example of WSMedia
used to output records to the client in XML
format, see Customize XML serialization with WSName and XMLName
For WSMedia
examples using images or files, see Example: upload a file in a multipart request.