title: How to send html content with xml/json request in rest api?
body: <p>I am writing a restful service to send the email in spring boot. 
  API request is mapped with object.<br>
  When I am sending xml in request it works fine but in body I want to send HTML content. </p>
  
  <pre><code>Below is the request without html
      &lt;mailContent&gt;
          &lt;from&gt;abc@gmail.com&lt;/from&gt;
          &lt;to&gt;
                  &lt;email&gt;xyz@gmail.com&lt;/email&gt;
          &lt;/to&gt;
  
          &lt;subject&gt; MY ALERT &lt;/subject&gt;
          &lt;contentType&gt;multipart/mixed&lt;/contentType&gt;      
          &lt;body&gt;
              Hi Raj \n
              How are you?
          &lt;/body&gt;
      &lt;/mailContent&gt;
  </code></pre>
  
  <p>With HTML</p>
  
  <pre><code>    &lt;mailContent&gt;
          &lt;from&gt;abc@gmail.com&lt;/from&gt;
          &lt;to&gt;
                  &lt;email&gt;xyz@gmail.com&lt;/email&gt;
          &lt;/to&gt;
  
          &lt;subject&gt; MY ALERT &lt;/subject&gt;
          &lt;contentType&gt;multipart/mixed&lt;/contentType&gt;      
          &lt;body&gt;
              &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Page Title&lt;/title&gt;
  &lt;style&gt;
  body {
    background-color: black;
    text-align: center;
    color: white;
  }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;h1&gt;This is a Heading&lt;/h1&gt;
  &lt;p&gt;This is a paragraph.&lt;/p&gt;
  &lt;img src="https://www.w3schools.com/tryit/avatar.png" alt="Avatar" style="width:200px"&gt;
  &lt;/body&gt;
  &lt;/html&gt;
          &lt;/body&gt;
      &lt;/mailContent&gt;
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>public SendMailResult sendMail(@ApiParam("Contains the mail content and configurations to be used for sending mail") @Valid @RequestBody MailMessage message, BindingResult result) throws InterruptedException {
  
          SendMailResult results = new SendMailResult();
          message = sendemailService.prepareMessage(message);
  
  ....
  }
  </code></pre>
  
  <p>When I add HTML in XML it fails to map request with the object.</p>