Character String Encoding
When SOAPam Server copies "string" fields between the SOAP envelope and the server IPM it assumes that the data is stored in the IPM using the default server encoding which is ISO-8859-1 encoding. The encoding used can be altered on the element, type, or service level using the encoding attribute in the Service Definition File:
- To set the encoding for an individual element, set the encoding attribute on the element element.
- To set the default encoding for all child elements of a specific type, set the encoding attribute on the type element.
- To set the default encoding on all types in a service set the encoding attribute on the types element.
- To set the default encoding for all services on a specific server instance set the -servicedefaultencoding startup option to the desired encoding.
The value of the encoding attribute or the -servicedefaultencoding startup option can be any of the value Character Encoding Names.
The encoding can also be altered by the client application during the method call using the SOAPam defaultEncoding header. In order to use the header it must first be defined in the Service Definition File. The header is defined as follows:
<method name="myMethod" server="myServer">
<headers>
<header name="defaultEncoding" type="defaultEncodingType" namespace="http://soapam.com/types/" direction="in" />
... other headers ...
</headers>
... other method elements ...
</method>
When this header is specified for a method the client application can alter the default encoding for the server IPM request and response by sending the defaultEncoding header. The defaultEndcoding header can specify either the server request encoding, response encoding, or both. The following header instructs SOAPam Server to using ISO-8859-7 encoding when executing this method.
<defaultEncoding xmlns="http://soapam.com/types/">
<requestEncoding>ISO-8859-7</requestEncoding>
<replyEncoding>ISO-8859-7</replyEncoding>
</defaultEncoding>
Note that SOAPam Server always uses UTF-8 encoding for the SOAP envelope.
Refer to Character Encoding Names for a complete list of the available character encodings.