Jump to content

Getting error when uploading jrxml using webservices in java code


sri.vedantham

Recommended Posts

I am using JasperServer 5.0.1

Here is my code:

-----------------------------------------------------------------

import com.jaspersoft.ireport.jasperserver.JServer;

import com.jaspersoft.ireport.jasperserver.ws.WSClient;

import com.jaspersoft.jasperserver.api.metadata.xml.domain.impl.ResourceDescriptor;

JServer jServer = new JServer();

String jUserName = "jasperadmin|sumtotal";

String jPassword = "jasperadmin";

String webserviceURL = "http://localhost:8280/jasperserver-pro/services/repository?wsdl";

String dataSourceURI = "/Data_sources/SP91_8310_DW";

 

//String reportsFolderPath = "/organizations/organization_1/organizations/sumtotal/Reports/Canned";

String reportsFolderURI = "/organizations/organization_1/organizations/sumtotal/Reports/Canned/Repo1_files";

 

File resourceFile = null;

 

 

//Authenticate

jServer.setUsername(jUserName);

jServer.setPassword(jPassword);

jServer.setUrl(webserviceURL);

 

 

WSClient client = new WSClient(jServer);

 

//prepare the resource descriptor for jrxml

ResourceDescriptor jrxmlDis = new ResourceDescriptor();

jrxmlDis.setWsType(ResourceDescriptor.TYPE_JRXML);

jrxmlDis.setName("Instructor_Details");

jrxmlDis.setLabel("Instructor Details");

jrxmlDis.setDescription("Instructor Details report");

jrxmlDis.setIsNew(true);

jrxmlDis.setHasData(true);

jrxmlDis.setMainReport(true);

jrxmlDis.setReferenceUri(reportsFolderURI);

jrxmlDis.setIsReference(true);

 

//prepare the resource descriptor for data source

ResourceDescriptor dsDis = new ResourceDescriptor();

dsDis.setWsType(ResourceDescriptor.TYPE_DATASOURCE);

dsDis.setReferenceUri(dataSourceURI);

dsDis.setIsReference(true);

 

//add the above descriptors

ResourceDescriptor rd = new ResourceDescriptor();

rd.getChildren().add(dsDis);

rd.getChildren().add(jrxmlDis);

 

//resourceFile = new File(getFileResourceURL("InstructorDetails.jrxml") );

resourceFile = new File("F:/JasperWork/JReports/InstructorDetails.jrxml");

 

ResourceDescriptor result = client.addOrModifyResource(rd, resourceFile);

-------------------------------------------------------------------------------------------------------------------------------

and this is the error I get

May 07, 2013 5:05:52 PM org.openide.util.NbPreferences getPreferencesProvider

WARNING: NetBeans implementation of Preferences not found

2013-05-07 17:05:53,613 main INFO [commons.httpclient.auth.AuthChallengeProcessor] basic authentication scheme selected

java.lang.Exception: 6 - No URI given.

at com.jaspersoft.ireport.jasperserver.ws.WSClient.putReportUnitResource(WSClient.java:570)

at com.jaspersoft.ireport.jasperserver.ws.WSClient.modifyReportUnitResource(WSClient.java:509)

at com.jaspersoft.ireport.jasperserver.ws.WSClient.addOrModifyResource(WSClient.java:463)

at myTest.helloWorld.main(helloWorld.java:98)

Exception in thread "main"

java.lang.Exception: 6 - No URI given.

at com.jaspersoft.ireport.jasperserver.ws.WSClient.putReportUnitResource(WSClient.java:570)

at com.jaspersoft.ireport.jasperserver.ws.WSClient.modifyReportUnitResource(WSClient.java:509)

at com.jaspersoft.ireport.jasperserver.ws.WSClient.addOrModifyResource(WSClient.java:463)

at myTest.helloWorld.main(helloWorld.java:98)

-------------------------------------------------------------------------------------------------------

Is there anything missing? Can you give details steps to correct the code.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...