title: Using retrofit with XML data
body: <p>I would like to call an API (@POST) who works with XML data. And i litteraly don't know how to send it '-'. I learnt how do to with Json, but different with XML</p>
  
  <p>I search for like 3/4 days and i couldn't find any solution that fit for me :/</p>
  
  <p>Here is the request i need to send :</p>
  
  <pre><code>&lt;qosFeatureData xmlns:qos="urn:oma:xml:rest:netapi:qos:1"&gt;
  &lt;clientCorrelator&gt;v1234&lt;/clientCorrelator&gt;
  &lt;predefinedQosFeatureId&gt;Pred_Coca&lt;/predefinedQosFeatureId&gt;
  &lt;media&gt;
      &lt;mediaNumber&gt;1&lt;/mediaNumber&gt;
      &lt;mediaType&gt;Other&lt;/mediaType&gt;
      &lt;ipFlow&gt;
          &lt;flowNumber&gt;1&lt;/flowNumber&gt;
          &lt;flowDescription&gt;
                  &lt;direction&gt;Downlink&lt;/direction&gt;
                  &lt;protocol&gt;6&lt;/protocol&gt;
                  &lt;otherPartyIpAddress&gt;
                  &lt;ipV4Address&gt;X.X.X.X&lt;/ipV4Address&gt;
              &lt;/otherPartyIpAddress&gt;
                  &lt;otherPartyPortNumber&gt;
                  &lt;port&gt;XX&lt;/port&gt;
                  &lt;/otherPartyPortNumber&gt;
                  &lt;userIpAddress&gt;
                  &lt;ipV4Address&gt;Y.Y.Y.Y&lt;/ipV4Address&gt;    ?????
                  &lt;/userIpAddress&gt;
          &lt;/flowDescription&gt;
          &lt;flowDescription&gt;
                  &lt;direction&gt;Uplink&lt;/direction&gt;
                  &lt;protocol&gt;6&lt;/protocol&gt;
                  &lt;otherPartyIpAddress&gt;
                  &lt;ipV4Address&gt;X.X.X.X&lt;/ipV4Address&gt;
                  &lt;/otherPartyIpAddress&gt;
                  &lt;otherPartyPortNumber&gt;
                  &lt;port&gt;XX&lt;/port&gt;
                  &lt;/otherPartyPortNumber&gt;
                  &lt;userIpAddress&gt;
                  &lt;ipV4Address&gt;Y.Y.Y.Y&lt;/ipV4Address&gt;    ?????
                  &lt;/userIpAddress&gt;
          &lt;/flowDescription&gt;
          &lt;flowStatus&gt;Enabled&lt;/flowStatus&gt;
      &lt;/ipFlow&gt;
      &lt;flowStatus&gt;Enabled&lt;/flowStatus&gt;
  &lt;/media&gt;
  </code></pre>
  
  <p></p>
  
  <p>I already set up the code for the call "Post" (with nothing in it) and i got a response (not a good response : 500, but i think it's because of my data who are not sent)</p>
  
  <p><strong>Here is my interface code</strong></p>
  
  <pre><code>public interface ApiHttpPost {
  
  @Headers({"Content-Type: application/xml; charset=utf-8"})
  @POST("confidential")
  Call&lt;qosFeature&gt; getqosFeature (@Header("Authorization") String authHeader);
  </code></pre>
  
  <p>}</p>
  
  <p><strong>Here my main activity</strong></p>
  
  <pre><code>private void AppelHttpPost() {
      Retrofit retrofit = new Retrofit.Builder()
              .baseUrl("CONFIDENTIAL")
              .client(getUnsafeOkHttpClient())
              .addConverterFactory(SimpleXmlConverterFactory.create())
              .build();
  
      ApiHttpPost service = retrofit.create(ApiHttpPost.class);
  
      String userName = "CONFIDENTIAL";
      String passWord = "CONFIDENTIAL";
      String base = userName + ":" + passWord;
  
      String authHeader = "Basic " + Base64.encodeToString(base.getBytes(), Base64.NO_WRAP);
  
      Call&lt;qosFeature&gt; qosFeatureCall = service.getqosFeature(authHeader);
  
      qosFeatureCall.enqueue(new Callback&lt;qosFeature&gt;() {
          @Override
          public void onResponse(Call&lt;qosFeature&gt; call, Response&lt;qosFeature&gt; response) {
              int statusCode = response.code();
              qosFeature qosFeature = response.body();
              Log.d(TAG, "onResponse: " + statusCode);
          }
  
          @Override
          public void onFailure(Call&lt;qosFeature&gt; call, Throwable t) {
              Log.d(TAG, "onFailure: " + t.getMessage());
          }
      });
  }
  </code></pre>
  
  <p>Thx for your help :s</p>
  
  <p>EDIT : i come back to require your help again, the solution proposed by Potapov Anton doesn't really work in my case. On Android studio, in debug mode i see something good ! (Screeshot)</p>
  
  <p><a href="https://i.stack.imgur.com/uJSl9.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>But when i look on Wireshark it's not good, there is the String /String that i don't want + the xml doesn't look well (Screenshot)</p>
  
  <p><a href="https://i.stack.imgur.com/idGFb.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>So any other idea to send xml data ? :x Thx</p>