How to pass SessionId from java webservice client to ReportExecutionService
I trying to execute the render method in the ReportExecutionService using AXIS java client. I call the loadReport which executed succesfully and I got the ExecutionId. But I am not sure where to set this ID. When I call the render method I am getting The session identifier is missing. A session identifier is required for this operation. ---> The session identifier is missing. A session identifier is required for this operation. Any help is appreciated Regards, Sri
May 1st, 2008 5:35pm

package client; import java.io.FileOutputStream; import java.io.OutputStream; import javax.xml.rpc.holders.ByteArrayHolder; import javax.xml.rpc.holders.StringHolder; import javax.xml.soap.SOAPElement; import org.apache.axis.client.Call; import org.apache.axis.message.SOAPHeaderElement; import org.apache.log4j.Logger; import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.*; import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.holders.*; public class GenerateReport { public void GenerateReport(String reportName, OutputStream ouptutStream) throws Exception { ReportExecutionServiceLocator exLoc = new ReportExecutionServiceLocator(); ReportExecutionServiceSoap rs = exLoc.getReportExecutionServiceSoap( new java.net.URL("http://yourserver:80/ReportServer/ReportExecution2005.asmx") ); org.apache.axis.client.Stub clientStub = (org.apache.axis.client.Stub) rs; clientStub._setProperty(Call.USERNAME_PROPERTY, "goraya"); clientStub._setProperty(Call.PASSWORD_PROPERTY, "goraya"); ExecutionInfo execInfo = new ExecutionInfo(); execInfo = rs.loadReport(reportName, null); SOAPHeaderElement sessionHeader = new SOAPHeaderElement( "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", "ExecutionHeader"); SOAPElement addChildElement = sessionHeader.addChildElement("ExecutionID"); addChildElement.addTextNode(execInfo.getExecutionID()); clientStub.setHeader(sessionHeader); String format = "PDF"; String devInfo = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"; ByteArrayHolder result = new ByteArrayHolder(); StringHolder extension = new StringHolder(); StringHolder mimeType = new StringHolder(); StringHolder encoding = new StringHolder(); ArrayOfWarningHolder warnings = new ArrayOfWarningHolder(); ArrayOfStringHolder streamIDs = new ArrayOfStringHolder(); rs.render(format, devInfo, result, extension, mimeType, encoding, warnings, streamIDs); ouptutStream.write(result.value); } public static void main(String args[]) { String path = "/Reports/Test Report"; try { FileOutputStream o = new FileOutputStream("C:\\TEMP\\TestReport.pdf"); new GenerateReport().GenerateReport(path, o); } catch (Exception e) { e.printStackTrace(); } } }
Free Windows Admin Tool Kit Click here and download it now
October 2nd, 2009 8:56am

Hi Raj, How are you doing?. I have taken your above code to display ssrs report in jsp but I am getting compile time errors could please provide me how can I use your code and plz let me know what is the procedure to access the ssrs serever and display the reports in browser. import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.*; import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.holders.*; are above files are predefined plz let what are the jar files I have to use Please send me complete code to access ssrs report through java. plzzzzzzz send me the details to my id shiva.java.b@gmail.com Thank you Shiva
March 26th, 2012 3:28am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics