halfer Posted May 2, 2008 Share Posted May 2, 2008 Hi all I am currently writing a PHP plugin for the symfony web development framework to integrate with JasperServer. I'd like to do this across SOAP, rather than using the PHP-Java bridge. I've downloaded the PHP examples, and the Web Services guide, and have come to an impasse. We can generate a PDF report nice and easily using the following SOAP request: Code:<request operationName="runReport"><resourceDescriptor name="" wsType="reportUnit" uriString="/reports/test/hamp-test-0.1" isNew="false"><label></label></resourceDescriptor><argument name="USE_DIME_ATTACHMENTS"><![CDATA[1]]></argument></request> However we would like to specify a datasource URI to go with that, so that we can run the report against several databases (dev, uat, prod etc). The WS Guide seems to suggest we need a resourceDescriptor with a wsType of "datasource", so we have tried this: Code:[code]<request operationName="runReport"><resourceDescriptor name="" wsType="reportUnit" uriString="/reports/test/hamp-test-0.1" isNew="false"><label></label></resourceDescriptor><resourceDescriptor name="" wsType="datasource" uriString="/datasources/logweb_prod" isNew="false"></resourceDescriptor><argument name="USE_DIME_ATTACHMENTS"><![CDATA[1]]></argument></request> This comes back with an error: Error message from report server: /datasources/logweb_prod is not a valid report so clearly it hasn't worked. Substantial searching in this forum hasn't revealed any examples. Can anyone shed any light? :S Thanks! Link to comment Share on other sites More sharing options...
halfer Posted May 2, 2008 Author Share Posted May 2, 2008 I've also tried running Wireshark on the TCP stream between iReport and the server, and tried what I believe iReport is sending to the server: Code:<request operationName="runReport"><resourceDescriptor name="" wsType="reportUnit" uriString="/reports/test/hamp-test-0.1" isNew="false"><label></label></resourceDescriptor><resourceDescriptor name="" wsType="datasource" uriString="" isNew="false"><![CDATA[/datasources/logweb_prod]]></resourceDescriptor><argument name="USE_DIME_ATTACHMENTS"><![CDATA[1]]></argument></request> Sadly that doesn't work either. I'll leave the project for a day and see if anyone here can give me the right syntax. Thanks again. Link to comment Share on other sites More sharing options...
lucianc Posted May 2, 2008 Share Posted May 2, 2008 I'm afraid that what you are trying to do is not currently supported. The runReport operation always executes the report using the data source which is specified as part of the report unit definition, and you cannot run the report other data sources. Dynamically switching between report data source could be achieved at this moment only via a custom data source implementation that uses a report parameter to delegate to arbitrary data sources. Regards,Lucian Link to comment Share on other sites More sharing options...
halfer Posted May 3, 2008 Author Share Posted May 3, 2008 Edit: I forgot to thank you for your assistance - thanks very much. Your time is appreciated :D Oh dear, that's one of our biggest bugbears with Crystal that we're trying to fix! I'm glad there's a workaround though. Would you be so kind as to give me an idea how to set up such a custom datasource implementation in iReport, or is this more involved than adding special kinds of parameters to a report? If I get really stuck here, I think my alternative may run as follows (comments from all welcome). I'll have two main folders on the server: "reports" and "reports-compiled". Whenever I add a new report to the server, I will run a script to copy them to the compiled file, duplicating each one across the various connections I will need to use it with. The name of each can be set to "<report><connection>" so that the connection is easily specified in a SOAP call.Post edited by: halfer, at: 2008/05/02 17:23 Link to comment Share on other sites More sharing options...
lucianc Posted May 6, 2008 Share Posted May 6, 2008 halfer wrote:Oh dear, that's one of our biggest bugbears with Crystal that we're trying to fix! I'm glad there's a workaround though. Would you be so kind as to give me an idea how to set up such a custom datasource implementation in iReport, or is this more involved than adding special kinds of parameters to a report? This would not be a trivial task. One would have to write JasperServer data source service implementation that reads the value of a specific report parameter, (somehow) resolves a different data source service based on this value and delegates to this data source service. A custom/bean data source object would be created in the repository and used as report unit data source. Further details depend on how exactly you expect this mechanism to work (both via web service and via the web UI). Regards,Lucian Link to comment Share on other sites More sharing options...
halfer Posted May 13, 2008 Author Share Posted May 13, 2008 Righty-ho, thanks for the clarification. Its strange, though, as my Java colleague says that he can pass a "connection object" to a Jasper library, so that an arbitrary JDBC connection can be used in preference to the datasource in the report, on the Jasper server. I'm not a Java person, but wonder whether studying the source code of whatever library he is using might yield some results? I am not keen to dig into this in too much detail, though, given that you have told me that what I'm trying to do would be very difficult. Link to comment Share on other sites More sharing options...
lucianc Posted May 13, 2008 Share Posted May 13, 2008 I don't know what exactly is your colleague doing, so I can't comment on that. Note however, that using a "Jasper library" might not be the same thing as running a report via the JasperServer webservice. Regards,Lucian Link to comment Share on other sites More sharing options...
halfer Posted May 20, 2008 Author Share Posted May 20, 2008 I think you're right, Lucian. I grilled him on it later, and extracted a confession that he may have been using the libraries locally, not via the web service. Meanwhile readers may be interested to see how I've solved this problem. My concern was that my reports would proliferate versions across each connection I want to use them with, and that I would have to write a script to delete old copies and to recreate new ones with a new JRXML file. In fact, the solution was easier than that. I created a JRXML file on Jasper Server, with a pathname like this: /reports/web/common/project/my-report Then, for each connection, I create report units that cross-reference this file, with each having the correct pre-defined data source set: /reports/web/conn1/project/my-report/reports/web/conn2/project/my-report/reports/web/conn3/project/my-report Now all I need to do is to refer to the correct pathname, which contains the connection name, and also if I need to update the core JRXML file, I can just republish the one file. Easy when you discover how B) Link to comment Share on other sites More sharing options...
glen Posted April 16, 2009 Share Posted April 16, 2009 Would it not work to create the report definition using an input parameter as the report datasource like you do for sub-reports. Then pass that as a parameter in the SOAP call ? Link to comment Share on other sites More sharing options...
swood Posted May 4, 2009 Share Posted May 4, 2009 glen, You cannot pass the data source as a parameter. That is only for parameters passed into the report. ShermanJaspersoft Link to comment Share on other sites More sharing options...
yaroslav Posted September 3, 2009 Share Posted September 3, 2009 Can you describe more detail how can I create report units that cross-reference to main file. Thanks Link to comment Share on other sites More sharing options...
lucianc Posted September 7, 2009 Share Posted September 7, 2009 yaroslavWrote: Can you describe more detail how can I create report units that cross-reference to main file. Thanks I guess that would involve uploading the JRXML as an independent resource in the repository, and then creating several report units that use the repository resource as main JRXML (chose From Content Repository in the report unit wizard).Regards,Lucian Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now