title: Consuming soap service with NTLM Authentication
body: <p>I am trying to consume a SOAP service with NTLM authentication by creating a NTLM engine (following instructions on <a href="http://hc.apache.org/httpcomponents-client-4.3.x/ntlm.html" rel="nofollow">http://hc.apache.org/httpcomponents-client-4.3.x/ntlm.html</a> ) implemented AuthSchemeFactory and finally registered the AuthSchemeFactory to my HTTP Client. When I hit the service using my HTTP Client I get a reponse that "Status code - 415 , Message - The server cannot service the request because the media type is unsupported."</p>
  
  <p>Can anybody tell how can I fix this issue of unsupported media to consume a NTLM-protected SOAP web service on Java platform. Is using JCIFS a correct option to conmsume NTLM protected service or are there any better approach(s). Thanks in advance. </p>
  
  <pre><code>    DefaultHttpClient httpclient = new DefaultHttpClient();
  
      httpclient.getAuthSchemes().register(AuthSchemes.NTLM,
              new JCIFSNTLMSchemeFactory());
  
      CredentialsProvider credsProvider = new BasicCredentialsProvider();
      NTCredentials ntcred = new NTCredentials("USERNAME", "PASSWORD",
              "HOST", "DOMAIN");
  
      credsProvider.setCredentials(new AuthScope("HOST", 443,
              AuthScope.ANY_REALM, "NTLM"), ntcred);
  
      httpclient.setCredentialsProvider(credsProvider);
  
      httpclient.getParams().setParameter(
              CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8");
  
      Writer writer = new StringWriter();
          writer.write("MY SOAP REQUEST BODY");
  
      HttpPost httppost = new HttpPost(
              "https://&lt;HOST_NAME&gt;/XiPay30WS.asmx");
      httppost.setEntity(new StringEntity(writer.toString()));
  
      httppost.setHeader("Content-Type",
                  "application/x-www-form-urlencoded");
  
      HttpResponse httpresponse = httpclient.execute(
                  new HttpHost("HOST", 443, "https"),
                  httppost, new BasicHttpContext());
  
      String statusCode = httpresponse.getStatusCode();
  </code></pre>