How should I architect JasperReports with a PHP front+backend system - java

Our system is written completely in PHP.
For various business reasons (which are a given) I need to build the reports of the system using JasperReports.
What architecture should I use? Should I put the Jasper as a stand alone server (if possible) and let the php query against it, should I have it generate the reports with a cron, and then let the PHP scoop up the files and send them to the web client/browser...

JasperServer seems to be the best option, having:
Comprehensive Web Services, Java, and HTTP APIs, as well as support for Web Services from non-Java environments such as .NET (C#), C++, and PHP
Another option is to implement something like that yourself, with only the functionality you need. Make a separate java web-app that generates the reports, using either web-services or REST to communicate with it.

If you like to keep things simple and "free", then i recommend:
Build your own small Java webapp.
Use DynamicJasper to build customized reports.
Expose a web service from the Java app, and call it from your PHP.
Java app will reply with a PDF file.

You can use the php java extension and compile and generate the report right from php. Example code and instructions: here.

Related

Calling Python machine learning service from Java as an OS process or micro service via REST

I am building a web application for business management as a side project and i face an architecture problem.
My application will be an Angular web client communicating with a kotlin/java spring back-end via REST. One of the modules of the application will be time series forecasting of sales/orders, and because of the ease of development and the piles of documentation that exists online, i want to build that module in python. That module will generate dynamic html plots that i want to serve to the client. So my question is, it would be better if i do the python part as a stand alone rest micro service with Flask or it's ok to just put the python code inside the java project and call it using ProcessBuilder? Thanks in advance :)
My view will be to create a microservice with Python Flask with certain REST endpoints for obtaining the results and let java application interact with python based microservice for machine learning. The main advantage with this approach will be the separation of concern and deployment will be independent and you can leverage the benefits of microservice architecture.
Although it is also possible to bundle python code inside java or you can use jython, any changes in either in java code or in python code will add extra overhead for deployment. Bundling additional non java code will be another overhead for different OS systems like Windows, Mac and Linux.
You can check the following links for reference.
https://www.datacamp.com/community/tutorials/machine-learning-models-api-python

how to use java code from .net desktop application?

I want to Use Some Java Code From the WCF Service. Basically I need to intreact with the java application from the .net so how can I make it out for that? Any guidance for that?
I was just wondering that how can i call java code from my .net desktop application? Do I need to create .exe file of my java poject or jar? How would I invoke that java project from my .net desktop application?
Like some code in .net desktopp application will call
void startprocessing ();
code written in java application
Let me Clear the Things What i want to implement..
I have one desktop appplication of windows and I want to integrate my speech recgnition facility in that application which is in java. What I want is to exchange the audio data as binary and some strings from .net application to my java application so I can process on that binary data to convert wav file and etc and recginze it..that is just completed ..but what I need to know is how to send those strings and some binary data to java application and just invoke that java application ?? Do I need to 'use'(?) wcf or other service ?
Going out on a limb here, sounds like you java app needs to expose the method you want to call via a web-service. That's of course assuming you have control over that in terms of the java app you're interacting with. Not sure though you can access that method simply by compiling your java app to native.
You can take a look at JNBridge, which provides interop possibilities between Java and .NET. However, as another poster has suggested, exposing the functionality through a web service is probably a better solution.
A quick Google search will give you plenty of information on how to create web services in Java, but for starters you can take a look at: http://docs.oracle.com/javaee/6/tutorial/doc/bnayl.html
I have Successfully done that with the axis 2 webservice with tomcat apache server with the following link..its too easy .i really got succeeded
http://blog.sencide.com/2011/06/create-web-service-using-apache-axis2.html

What advantages are there on using GWT over a php framework such as Yii

I am about to start developing a private TODO website (that later will be extended to Web applications). I am unsure what framework to use. I have read about GWT and PHP frameworks such as Yii. What advantages do each one have over another.
Background
- experience in Java
- got an apache web host that supports php
Doubts:
Would developing in GWT mean that refactoring would be easier than developing in PHP (especially since you can use Eclipse)
seems like PHP frameworks such as Yii design objects for you once you create database layout ... can this be done with GWT?
Thanks!
One big difference I haven't seen mentioned in the question or answers/comments is that Yii is a server-side framework, which runs entirely on your own/hosted server, whereas GWT compiles to JavaScript, and is therefore runs in the client's browser only. These two offerings (and ideas) serve very different purposes, and can be used together.
When using GWT to build the client, the server can be built using any tool desired, so long as it exposes data to the JS-based client. That can be in the form of JSON or XML, or some other data encoding (GWT's built in RPC, for example, can pass complex object graphs to and from a Java servlet container).
If you were to use them together, Yii could be used to create PHP objects from the database schema/layout, and to build the various rules for authentication/authorization so the client can read and write data. GWT could then be used to build a client which reads and updates that data, making calls to services exposed by Yii/PHP code.
If you like Eclipse you can certainly stay with Eclipse and still develop in PHP. The PHP tools from eclipse.org are very good and the IDE plugin from Aptana is even better.
Regarding Yii vs GWT, it really depends on your language of choice. If you are highly proficient in Java and really like the strong typing of the Java language then GWT is a good choice (although there are certainly other choices that keep you in the Java world such as Tapestry). PHP frameworks vary quite widely in how much they embrace OOP and concepts such as creating your business objects based on your database. Yii definitely stands out as a framework due to the code generation capabilities built in. That will definitely help you if you're getting started with PHP.

is it possible to have a hybrid PHP+Java web application on Google App Engine?

I want to create an application that submits same/similar data to sites containing web forms. These sites use PHP scripts...
I have a php script with me, that submits data in the manner that i require, to such forms. What I want to do is, design an entire web app around this code... I tried to obtain equivalent java code that does what the php code is doing, but could not obtain such code...
Since Google App Engine supports Quercus framework for PHP, what I am thinking now is, use the PHP code for actual submission of forms to their actions, and rest of application (that tracks all submissions and does other stuff like login/logout...) is in Java.
This would require some method by which I can pass the relevant form parameters from Java code to the PHP script, then some way for the php script to return the response of each submission back to the java code.
Is such an application doable? Pls keep in mind that I want to use Google App Engine for this purpose.
Nowadays it is possible to use different languages in different modules of the same app.
See Using both Java and Python with the new "Module" feature on AppEngine?
It should be doable with Quercus. We deploy a Python app that has some Java/Clojure backend processors but both languages are "native" to GAE. Using PHP will be a serious pain and not worth it all. I suggest that you just learn Python you will master it faster than using Quercus on GAE.
If you also go after PHP you stick to your LAMP knowledge. I suggest thay you do now!
Disclaimer: I wanted to use JRuby on AppEngine but I had a lot of difficulties (plus you have to know how everything works optimally on GAE) so I took up Python

A Java and PHP application

Is it possible to build a Java web application which has a PHP front end ?
I want all my web pages to be coded in PHP. Most of them will be forms.
I want all the data submitted by a form to go to a Java Code.
I want to do all manipulation in back end and all rendering of web content on the front end.
This is just a general question as I was probing for different options for my java web application.
You might also want to take a look at php-java bridge
A web application, by definition is already a frontend (or at least includes it).
If you meant a PHP webapp built on top of a Java backend, sure, that's possible. If you use SOAP or REST for communication between the layers, it's actually relatively easy. The only drawback compared to a pure Java (or pure PHP) app would be the overhead of those protocols, so you have to be careful to avoid too fine-grained service interfaces.
It depends on where the two meet. You could have, for example, have Java backend and PHP frontend communicating via web services. I however see no benefit in such a combination.
You can use Quercus, a Java implementation of PHP, to run PHP from within Java (and thus have easy access to Java classes).
According to your edition, it looks like you don't need PHP at all. You confused it with HTML.
Yes. You can build a java web-application which has php front end.
it is possible even with C++ backend. but why?

Categories