title: nested exception is web.reactive.function.UnsupportedMediaTypeException: Content type 'text/html;charset=utf-8' not supported for bodyType
body: <p>Created a REST Webservice(Service 1) which tries to consume another service(Service 2) which returns Content-Type = &quot;text/html;charset=utf-8&quot;</p>
  <p>my WebClient code that consumes another service:</p>
  <pre><code>ublic &lt;T, N&gt; N invokeService(String endPointUrl, HttpMethod httpMethod, HttpHeaders headers, T requestPayload,
              Class&lt;T&gt; requestPlayLoadClass, Class&lt;N&gt; serviceResponseClass) {
      UriSpec&lt;RequestBodySpec&gt; uriSpec = webclient.method(httpMethod);
      RequestBodySpec bodySpec = uriSpec.uri(endPointUrl);
      RequestHeadersSpec&lt;?&gt; headersSpec = buildRequest(headers, requestPayload, requestPlayLoadClass, bodySpec);
  
      Mono&lt;N&gt; res = headersSpec.retrieve()
                  .onStatus(HttpStatus::is4xxClientError, clientResponse -&gt; handle4xxError(clientResponse))
                  .onStatus(HttpStatus::is5xxServerError, clientResponse -&gt; handle5xxError(clientResponse))
                  .bodyToMono(serviceResponseClass);
  
      return res.block();
  
  }
  
  private &lt;T&gt; RequestHeadersSpec&lt;?&gt; buildRequest(HttpHeaders headers, T requestPayload, Class&lt;T&gt; requestPlayLoadClass,
              RequestBodySpec bodySpec) {
          RequestHeadersSpec&lt;?&gt; headersSpec = bodySpec.headers(clientHeaders -&gt; clientHeaders.addAll(headers));
          if (requestPayload != null &amp;&amp; requestPlayLoadClass != null) {
              headersSpec = bodySpec.body(Mono.just(requestPayload), requestPlayLoadClass);
          }
          return headersSpec;
      }
  </code></pre>
  <p>I am getting the below error:</p>
  <pre><code>org.springframework.web.reactive.function.client.WebClientResponseException: nested exception is org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'text/html;charset=utf-8' not supported for bodyType
      at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:212) ~[spring-webflux-5.3.6.jar:5.3.6]
      at org.springframework.web.reactive.function.client.DefaultClientResponse.lambda$createException$1(DefaultClientResponse.java:216) ~[spring-webflux-5.3.6.jar:5.3.6]
      at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106) ~[reactor-core-3.4.5.jar:3.4.5]
      at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79) ~[reactor-core-3.4.5.jar:3.4.5]
      at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2397) ~[reactor-core-3.4.5.jar:3.4.5]
      at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2193) ~[reactor-core-3.4.5.jar:3.4.5]
      at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onSubscribe(FluxOnErrorResume.java:74) ~[reactor-core-3.4.5.jar:3.4.5]
      
  </code></pre>
  <p>Response Pojo class:</p>
  <pre><code>@Data
  public class ServiceResponse{
  
      private String name;
      private String systemDevice;
      private String key;
  }
  </code></pre>
  <p>the response which I am receiving:</p>
  <pre><code>&lt;HTML&gt;
  
  &lt;HEAD&gt;
      &lt;TITLE&gt;Connect Servlet Version 6&lt;/TITLE&gt;
  &lt;/HEAD&gt;
  
  &lt;BODY&gt;
      &lt;H3&gt;Message Response from Connect Servlet for Version 6&lt;/H3&gt;
      &lt;BR&gt;Connect Server running servlet &lt;BR&gt;
      &lt;HR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;interface:
      IManagement&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;method: deliverevent&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;contactevent: PauseRecord&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;agent.agent: test&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;agent.systemdevice: Screen Data Source&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;device.systemdevice: test_lab&lt;br&gt;ContactEvent: DEVICE_NOT_IN_CALL
      &lt;HR&gt;
  &lt;/BODY&gt;
  
  &lt;/HTML&gt;
  </code></pre>
  <p>Can anyone please suggest me?</p>