title: Trying to integrate Java and SSRS 2012
body: <p>I am trying to write a Java application that will show reports from SSRS 2012.  I set up my web services proxy and I have this code to try to log in to the server:</p>
  
  <pre><code>try
  {
      ReportExecutionServiceSoapStub service = getService();
      System.out.println("ADP1N: Test.main, Checkpoint Bravo...");
      service.logonUser("CAMPUSAD/&lt;username&gt;", "&lt;password&gt;", "");
  } catch (Exception e)
  {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>But I keep getting this error:</p>
  
  <pre class="lang-none prettyprint-override"><code>Apr 29, 2013 3:29:32 PM org.apache.commons.httpclient.HttpMethodDirector authenticate
  SEVERE: Credentials cannot be used for NTLM authentication:         org.apache.commons.httpclient.UsernamePasswordCredentials
  org.apache.commons.httpclient.auth.InvalidCredentialsException: Credentials cannot be used for NTLM authentication: org.apache.commons.httpclient.UsernamePasswordCredentials
  at org.apache.commons.httpclient.auth.NTLMScheme.authenticate(NTLMScheme.java:331)
  at org.apache.commons.httpclient.HttpMethodDirector.authenticateHost(HttpMethodDirector.java:281)
  at org.apache.commons.httpclient.HttpMethodDirector.authenticate(HttpMethodDirector.java:233)
  at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:169)
  at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
  at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:196)
  at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
  at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
  at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
  at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
  at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
  at org.apache.axis.client.Call.invoke(Call.java:2767)
  at org.apache.axis.client.Call.invoke(Call.java:2443)
  at org.apache.axis.client.Call.invoke(Call.java:2366)
  at org.apache.axis.client.Call.invoke(Call.java:1812)
  at com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ReportExecutionServiceSoapStub.logonUser(ReportExecutionServiceSoapStub.java:1893)
  at Test.main(Test.java:29)
  Apr 29, 2013 3:29:32 PM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge
  INFO: Failure authenticating with NTLM &lt;any realm&gt;@ais-fgnk3k1:80
  AxisFault
   faultCode: {http://xml.apache.org/axis/}HTTP
   faultSubcode: 
   faultString: (401)Unauthorized
   faultActor: 
   faultNode: 
   faultDetail: 
      {}:return code:  401
  
      {http://xml.apache.org/axis/}HttpErrorCode:401
  
  (401)Unauthorized
      at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:218)
      at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
      at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
      at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
      at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
      at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
      at org.apache.axis.client.Call.invoke(Call.java:2767)
      at org.apache.axis.client.Call.invoke(Call.java:2443)
      at org.apache.axis.client.Call.invoke(Call.java:2366)
      at org.apache.axis.client.Call.invoke(Call.java:1812)
      at com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ReportExecutionServiceSoapStub.logonUser(ReportExecutionServiceSoapStub.java:1893)
      at Test.main(Test.java:29)
  </code></pre>
  
  <p>I even tried this code and got the same results:</p>
  
  <pre><code>ExecutionInfo info = service.loadReport("http://usys-dbd1.dev.ais.msu.edu/ReportServer/Pages/ReportViewer.aspx?%2fUSYS%2fAdvisor+Scheduling%2fAdvisor_Scheduling_Report&amp;amp;rs:Command=Render", null);
  </code></pre>
  
  <p>My rsreportserver.config file has these authentication entries:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Authentication&gt;
      &lt;AuthenticationTypes&gt;
           &lt;RSWindowsNegotiate /&gt;
           &lt;RSWindowsKerberos /&gt;
           &lt;RSWindowsNTLM /&gt;
      &lt;/AuthenticationTypes&gt;
      &lt;RSWindowsExtendedProtectionLevel&gt;Off&lt;/RSWindowsExtendedProtectionLevel&gt;
      &lt;RSWindowsExtendedProtectionScenario&gt;Proxy&lt;/RSWindowsExtendedProtectionScenario&gt;
      &lt;EnableAuthPersistence&gt;true&lt;/EnableAuthPersistence&gt;
  &lt;/Authentication&gt;
  </code></pre>
  
  <p>I am not sure what I am doing wrong here.</p>