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;
}
}
}