title: Rendering SSRS Reports in Java
body: <p>I am working a on project which should render SSRS reports in Java.</p>
  
  <p>Below is the procedure that I have followed.</p>
  
  <ol>
  <li>Installed Eclipse</li>
  <li>Created a java project By setting Execution Environment Java SE 1.8</li>
  <li>Created a proxy using wsimport </li>
  </ol>
  
  <p><a href="http://i.stack.imgur.com/9VnpB.png" rel="nofollow">wsimport image</a></p>
  
  <ol start="4">
  <li>Added the references for the generated proxy</li>
  </ol>
  
  <p><a href="http://i.stack.imgur.com/j099u.png" rel="nofollow">added classed</a></p>
  
  <ol start="5">
  <li><p>Written this code </p>
  
  <pre><code>import javax.xml.ws.BindingProvider;
  import javax.xml.ws.Holder; 
  
  import  com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ArrayOfString;
  import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ArrayOfWarning;
  import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ExecutionHeader;
  import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ExecutionInfo;
  import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ReportExecutionService;
  import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.ReportExecutionServiceSoap;
  
  
    public class Render {
  
   static {
            java.net.Authenticator.setDefault(new java.net.Authenticator()   {
      @Override
      protected java.net.PasswordAuthentication getPasswordAuthentication() {
          return new java.net.PasswordAuthentication("username", "pwd".toCharArray());
      }
  });
  }
  
  public static void main(String[] args) {
  
  String reportPath = "/Reporting/Customers" ;
  String format = "HTML4.0";
  String historyID = null;
  String devInfo = "&lt;DeviceInfo&gt;&lt;Toolbar&gt;False&lt;/Toolbar&gt;&lt;HTMLFragment&gt;True&lt;/HTMLFragment&gt;&lt;/DeviceInfo&gt;";
  String executionID = null;
  Holder&lt;String&gt; extension = null;
  Holder&lt;String&gt; mimeType = null;
  Holder&lt;String&gt; encoding = null;
  Holder&lt;ArrayOfWarning&gt; warnings = null;
  Holder&lt;ArrayOfString&gt; streamIDs = null;
  Holder&lt;byte[]&gt; result = new Holder&lt;byte[]&gt;(); 
  
  ReportExecutionService res = new ReportExecutionService();
  ReportExecutionServiceSoap ress = res.getReportExecutionServiceSoap(); 
  
  BindingProvider bp = (BindingProvider)ress; 
  
  bp.getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);  
  
  ExecutionInfo execInfo = new ExecutionInfo();  
  execInfo = ress.loadReport(reportPath, historyID); 
  executionID = execInfo.getExecutionID();       
  bp.getRequestContext().put("sessionID", executionID); 
  
  ExecutionHeader eh = new ExecutionHeader();
  eh.setExecutionID(executionID); 
  System.out.println(executionID);
  ress.render(format, devInfo, result, extension, mimeType, encoding, warnings, streamIDs);
  
  String resultString = new String(result.value); 
  
  }
  
  }
  </code></pre></li>
  </ol>
  
  <p>When I am running this code , i am getting the below error.</p>
  
  <pre><code>     Exception in thread "main"    com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: The session identifier is missing. A session identifier is required for this operation.  ---&gt; Microsoft.ReportingServices.Diagnostics.Utilities.MissingSessionIdException: The session identifier is missing. A session identifier is required for this operation.  Please see the server log to find more detail regarding exact cause of the failure.
  at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(Unknown Source)
  at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)
  at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(Unknown Source)
  at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(Unknown Source)
  at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(Unknown Source)
  at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
  at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
  at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
  at com.sun.proxy.$Proxy35.render(Unknown Source)
  at Render.main(Render.java:50)
  </code></pre>
  
  <p>I am new to java, am I missing something ? I already set session id.</p>
  
  <p>any help is appreciated. </p>
  
  <p>Thanks in advance.  </p>