code: public <T> void writeBody(T body, Charset charset) {
          if (isPrimitive(body)) {
              String bodyAsString = String.valueOf(body);
              writeBodyFromString(bodyAsString, charset);
          } else if (isString(body)) {
              String bodyAsString = (String)body;
              writeBodyFromString(bodyAsString, charset);
          } else {
              writeBodyFromObject(body, charset);
          }
      }
docs: <p>Writes the message body using the given object of type T
  using the given charset for character encoding.</p>
  
  <p>For primitive types and Strings, the message body is written as
  plain text. In all other cases, the object is serialized to XML.</p>
  
  @param body The message body
  @param charset The charset to use for character encoding
  @param <T> The object type