Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Integrating J2EE application with SQL Server Reporting Services  RSS feed

 
Abdullah Al Fararjeh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

I want to integrate a J2EE application with SQL Server 2005 Reporting Services. In fact, it is the first time to be involved in developing an interoperability component between .Net web service and Java application. So I have learned for some time how to pass this challenge. Moreover, I found the following virtual lab is an excellent starting point "MSDN Virtual Lab: Implementing SQL Server Reporting Services with a Java Enterprise Edition (EE) Application" http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032315323&EventCategory=3&culture=en-US&CountryCode=US

After going through the lab, I tried to apply the same code in my machine but I have stuck with the following error:

; nested exception is:
org.xml.sax.SAXParseException: Premature end of file.


I use the following tools:
- Netbeans IDE 6.5
- Java SDK: build 1.6.0_01-b06
- Web Server: Apache Tomcat 6.0
- axis Jars (axis.jar, axis-ant.jar, commons-discovery-0.2.jar, commons-logging-1.0.4.jar, jaxrpc.jar, log4j-1.2.8.jar, saaj.jar, wsdl4j-1.5.1.jar)
- Reporting Tool: SQL Server 2005 Reporting Services

I will be so grateful if someone help me. I am waiting your response
this is a snippet of my code :


package net;

//import java.io.*;
import com.microsoft.schemas.sqlserver._2005._06._30.reporting.reportingservices.*;
import java.io.Serializable;


/**
*
* @author Abdullah Al Fararjeh
*/
public class NetData implements Serializable
{
static String[] data;


public NetData(){}


public static String[] getData(String myURL, String searchStr)
{
try{
CatalogItem[] returnedItems;
String folderName = "/";
returnedItems = FindReports(folderName, myURL, searchStr);


if(returnedItems != null && returnedItems.length > 0){


int count = returnedItems.length;
data = new String[count];
for(int x = 0; x < returnedItems.length; x++){
data[x] = returnedItems[x].getPath();
}
}
else
data = new String[] {"No Records Found"};


return (data);
}
catch(Exception e){
System.out.println(e.getMessage());
String[] s = new String[1];
s[0] = e.getMessage();
return (s);
}
}


private static CatalogItem[] FindReports(String folderName, String serverUrl, String searchStr)
{
try
{
//CatalogItem find;


ReportingService2005Locator loc = new ReportingService2005Locator();
//retrieve a report from the service locator
ReportingService2005Soap port = loc.getReportingService2005Soap(new java.net.URL(serverUrl));


//set the HTTP Basic Authentication credintials using Stub object methods
javax.xml.rpc.Stub stub = (javax.xml.rpc.Stub) port;
stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, "abdullahPC\\abdullah");
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, "mypassword");


//set up a search condition where the item name contains the specified search string
SearchCondition condition = new SearchCondition();
condition.setCondition(ConditionEnum.Contains);


condition.setName("Name");


if(searchStr != null)
condition.setValue(searchStr);
else
condition.setValue("");


//create an array of SearchCondition which will contain our single search condition
SearchCondition[] conditions;
conditions = new SearchCondition[1];
conditions[0] = condition;


//Call the web service with the appropriate parameters
CatalogItem[] returnedItems;
System.out.println("before port.findItems");
returnedItems = port.findItems(folderName, BooleanOperatorEnum.Or, conditions);
System.out.println("after port.findItems");
return returnedItems;
}
catch(Exception e){
System.out.println(e.getMessage());
return null;
}
}
}

 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another approach is discussed in A Java proxy for MS SQL Server Reporting Services.
 
Abdullah Al Fararjeh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peer Reynders wrote:Another approach is discussed in A Java proxy for MS SQL Server Reporting Services.


Hello Peer,

Firstly, thank you for tip. I have read the article and. Then I downlaoded the attached library code with the article. After that, I changes the server URL and the credintial information. Unfortunately, I got the following error:

ReportRequest - ERROR: No cookie provided by report server. Aborting.

To explore the navigate the error, I have printed all hearder fields as the following

key: null, HTTP/1.1 302 Found
key: Server, Microsoft-IIS/5.1
key: Date, Sat, 14 Feb 2009 17:07:39 GMT
key: X-Powered-By, ASP.NET
key: X-AspNet-Version, 2.0.50727
key: Location, http://localhost/ReportServer05/Pages/ReportViewer.aspx?%2fSMSReports%2fReport1&rs%3aCommand=Render&rc%3aToolbar=false%0d%0a
key: Cache-Control, private
key: Content-Type, text/html; charset=utf-8
key: Content-Length, 249

So I have doubt of the following header parameter whose value "HTTP/1.1 3.2 Found". This code means redirection.


Do you have any suggestion?
 
Abdullah Al Fararjeh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More info about HTTP 302, please look at:

http://en.wikipedia.org/wiki/HTTP_302
 
Lungelo Ndaba
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Abdullah,

Did you come right with this?

I am doing the very same type of application using the code you pasted above. But I am getting a similar error:

ERROR: No cookie provided by report server. Aborting.

Please let me know how you managed to fix it if you did.

Thanks,

Lungelo
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!