I have a webservice which has to return player details in response. The problem is, when I send same request in SoapUI I get valid response, but when I do this through Java, I get back this message in
<faultstring> Unsupported content type: text/plain; charset=ISO-8859-1 </faultstring>. 
Any ideas why it is the problem?
This is request I am sending:
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:gen=" ">   
> <soapenv:Header/>   
> <soapenv:Body>
>       <gen:GetPlayerDetails>
>          <request>
>             <systemUID>C_GS01</systemUID>
>             <sessionID>TVM0MgAAB9IAAAFEjXyfxbvZ2oU_</sessionID>
>          </request>
>       </gen:GetPlayerDetails>    
> </soapenv:Body>
> </soapenv:Envelope>
SOLVED thanks to @helderdarocha Made some changes (last line) in my HTTP client class:
        HttpClient httpclient = HttpClientBuilder.create().build();
        StringEntity strEntity = new StringEntity(request);
        HttpPost post = new HttpPost("http://10.47.44.163:8080" + endPointURI);
        post.addHeader("Content-type", "text/xml");
You are probably sending a request without the appropriate headers. You have to declare the type of data your client accepts as a response using the Accept header:
Accept: application/xml; application/json;
Additionally, if you are sending data, you have to declare the Content-type of what you are sending, and it should be compatible with the data your service accepts.
Content-type: application/xml
If you are sending payload in XML, for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With