Getting error when uploading jrxml using webservices in java code

0

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.

sri.vedantham's picture
Joined: Mar 6 2013 - 3:21am
Last seen: 7 years 4 months ago

0 Answers:

No answers yet
Feedback
randomness