Compile Jasper Report remoteley without Java-Bridge - java

Is there any way I can put jrxml files onto the Jasper server, link it to a datasource and let it compile without iReports, Java-Bridge, local Jaspersoft UI, ... I want to use as little Java as possible and I don't know about Apache ANT.
Can I do it through the (PHP) REST/SOAP API?
Or can I setup a little shell script on the Jasperserver that I can use like this way:
./compileMyReport.sh --report=/home/bla/test.jrxml --datasource=MongoDB_test_1

What do you mean by "Jasper server"? Do you mean the "JasperReports Server - Web Application" (http://community.jaspersoft.com/project/jasperreports-server)? If so, it does offer a REST interface. Have a look at the "JasperReports Server Web Service Guide" (http://community.jaspersoft.com/documentation?version=7114).
If you, however, only want to have reports somewhere and execute them programmatically that can also be arranged (and would be much easier than to go via the JasperServer Rest Interface). For this you would only need to set up a minimal java class. You could then simply call this "script" via a e.g. a system call and let it generate the report to disk. I've recently blogged about a security issue with jasperreports and there I'll also give the necessary code to execute jaspers: http://blog.datenwerke.net/2013/05/jasperreports-in-box-part-i.html
Hope that helps.

Related

not able to find the solution on Moskito integration with java web application without Moskito UI

1) I have done the Moskito moskito-inspect-standalone-2.5.0.war integration with Java Maven web project good.
2) But i need to work on a plain(without Maven[pom.xml]) java web app to integrate Moskito, here even i dont need Moskito UI. i wanted to see the data in logs or some format, but not in UI
My Environment:
Windows 7
Eclipse 4.4 having a plain Java Web Application (without Maven)
How can i do monitor and inspect my classes effectively by generating log data?
First of all, you can download .jar file directly and include in your project directly. Maven is not required in this case.
Any additional configurations (thresholds, accumulators etc.) can be found here.
To configure custom output, take a look at configure LOG4J for Moskito page, that will help you to output results wherever you want.

Auto generate / detect webserivce methods from the wsdl file in a java based web application

I need help of awesome tech people here. I'm trying to understand if I can generate a webservice stubs or class automatically using the wsdl file or is it possible to auto detect the methods or services available on the server side. My web application needs to detect these service methods, type of arguments they accept etc.
I know of some tools like wsdl2java or wsimport, but for this, I need to manually run some commands to generate the client stubs. Instead, I'm looking for a solution, where I can upload the wsdl file to my web application and my application can auto generate the java files, integrate it inside the application and start using it. Not sure if this is possible, but this is my requirement.
Please provide your suggestion or guide me to understand the do's or don'ts here. Many thanks.
take a look to this page :
Dynamic Web service invocation from a WSDL : http://www.computing.dcu.ie/~mwang/DI/di.html

How to build a command line interface in java for an existing web based application

I have created a web based application using JSP and Servlets and the application uses an SQL Server DB as its backend.
The architecture is like this:
I have all my business logic in a jar file
I have created my views using JSPs and am using servlets to interact with my business logic jar
The jar connects to the database to persist and hydrate information, which is relayed to the JSP by my servlets.
My web application runs on a remote Tomcat server.
Now, I have been given a new requirement. I have to create a command line interface, where I should be able to specify a list of commands and hit enter (or alternatively, create a set of commands and save it in a .bat file or something, and run it), so that my application performs the necessary actions. Basically, I have to create a command line interface, which can be used along with the GUI i already have (JSPs).
I am totally new to this. Can anyone throw light on where and how I can start?
Any little help is greatly appreciated.
EDIT
This is what my web application does. User can see a list of test scripts (written in Selenium WebDriver). He can choose script(s), choose a host on where to run them from, and click "Run", and the test executes on the said machines.
Now, I want a command line interface, which will eliminate the need for the GUI. Let's say, I simply want the user to be able to type a command like "execute My_Script_1", and the script should be executed.
The test scripts, the selenium drivers, everything reside on the App server.
My command line interface should be able to work on Windows command prompt.
Thank you.
Are you using Spring?
Can you specify, what exactly your CLI should do?
You may do, what Thomas said.
You also may use template engines like Velocity.. To form your output.
Use some kind of JavaCurses-like library to make your output... Look well.
Specifying commands...
Hm.. think about your business logic what exactly you are showing to user.
Remember webapp ui is webapp ui. Console ui is different. And user expects different behaviour
So commands like
show goods category="for kids"
Will be great.
Also don't forget about different help commands
yourJarName.jar --help / -h and etc
If your are want to write application with interactive mode... think about help command there.
You say you have your business logic in a JAR.
Why not starting another project with this JAR as a dependency and build it as an executable jar ?
Then simply use System.in and System.out to interact with the user.
EDIT :
So your application is hosted. Do you have an API like REST or SOAP or any other ?
Then you can build a client reading a string that the user has written, parsing it and calling the right service in your API.
I see two options:
Create a client-side CLI that generates the same data your server
receives. In other words, you don't modify your server code, and you create a
client-side CLI module (with jQuery for example) that parses the command lines and sends
exactly the same thing your actual GUI sends.
Set up a text area in your web app (decorated as a CLI) that reacts
on each Enter key pressed, and sends the line(s) to your server. On
your server, you can create a utility class (say CLIParser.java for
instance), and use Args4j to parse the received command,
validate it and run it.
Have you looked at Primefaces terminal? http://www.primefaces.org/showcase/ui/misc/terminal.xhtml
You data structure looks simple enough. Also you mentioned you designed your application the way the business logic is separated from the front end.
In this case you may consider exposing your business logic as a REST based WebService. It should not be that hard since you have layered structure in your application.
Looks like a few methods:
list scripts - returns a list of available scripts list hosts
returns a list of available hosts run script(scriptName, hostAddress)
runs script scriptName on a host with on address hostAddress possibly returns the results if your application supports this
All three look like a good candidates for GET methods.
You may consider Jersey or Resteasy or another framework.
You can find plenty tutorials for both of them. Take a look for example here.
From your command line application you can make calls to your web service in different ways. Just because I used to work with Jersey JAX-RS implementation most of the time, I found use of Jersey client(the latest stable version) the most convenient. Here you can find a short tutorial how you can do it from your command line application with Jersey client. JBoss also has a client API as a part of their framework(also fully certified JAX-RS implementation). You may even decide not to use any client API and do all the work manually utilizing HttpURLConnection, but I would not recommend. There is no big difference in using client API or do all the work manually with HttpURLConnection for the simple service, but you never know when your application becomes not that simple because of new requirements your client could not think of at the beginning.
Hope that helps

How is build-wsdl2java.xml generated?

I've inherited the code base for a Java application which talks to a few SOAP web services. Proxy classes to do this are generated using an ANT task calling wsdl2java. As my Java experience is quite limited, I'm still trying to get my head around exactly how this all works.
There is a build-wsdl2java.xml file in the project that seems to contain the configuration information required for the class generation. The file as it stands currently has attributes that aren't currently supported (namespacesmapfile, overWriteTypes, testcaseoverwrite), but if I attempt to resolve this by changing the first to 'namespacemappingfile' and removing the others, the attributes revert back if the project is cleaned. The URL for the WSDL also reverts back if it is changed.
What controls the generation of this file, and where do I define the configuration parameters that it contains?
Finally found out what was controlling this and, more importantly, have got things compiling again. I'm using JBuilder 2008 (an Eclipse based Java IDE from Embarcadero Technologies), and it would appear the client proxy classes were generated from the WSDL by using JBuilders built in support for this, which is effectively a wrapper for wsdl2java as mentioned by Noergaarde.
In order to set settings such as the URL for the WSDL, I had to switch to the Modeling perspective, and use the Model Navigator to change the URL, by selecting the class under the Web Service Client node and using the Properties view.
When you do a build of your project, does the timestamp of build-wsdl2java.xml change? ie. is this file generated by the build in another ant file?
At any rate, it certainly sounds like your client stubs are generated using AXIS.
http://ws.apache.org/axis/java/user-guide.html#WSDL2JavaBuildingStubsSkeletonsAndDataTypesFromWSDL

What benefits do GWT IDE plugins have considering that GWT is simply Java?

Seen that writing GWT code is basically writing Java code, what does a GWT for an IDE exactly do? For example there are GWT plugins for IDEA and for Eclipse (and maybe for NetBeans?) but do they do that I cannot do simply by using Eclipse or IDEA without the GWT plugin?
They add wizards, dialogs, editors, and other extensions to the IDE that help specifically with GWT tasks. For example, rather then creating a new GWT project from scratch using the command line, or creating an eclipse java project and then creating all the necessary files yourself, the plug-in adds a wizard that lets you type in the name of the project, and it creates all the necessary files for you.
Other additions can be large stuff like a local server, or minimal like a source code formatter. The sky is the limit with plug-ins.
I know the GWT adds a GUI editor to eclipse so you can drag and drop controls rather then manually entering them all.
I've only used the IDEA plugin myself. I definitely would not want to give it up. As others have said, you can create a GWT project and debug in hosted mode as easily as you would run any other application, but that's only the beginning.
IDEA also has several GWT-specific class creation options. You can create a new UiBinder file, which will generate both the .ui.xml file and the Java file, and will already have the plumbing in place for creating the UiBinder object. You can create a new GWT Remote Service, which will create the service interface, async interface, and implementation class for you.
The GWT plugin will also warn you about tons of probable errors right in the editor. It will warn you if your service interface doesn't have proper matching methods in the async interface, and has an intention for fixing the problem. It will warn if your service implementation class does not have an entry defined in the web.xml file (yep, with an intention available to automatically register it). It will warn you if you have fields in your UiBinder class that aren't defined in the .ui.xml file, again with an intention to help resolve the issue with just a couple keystrokes.
On top of that, the code completion is excellent for everything including CSS attributes, Javascript, HTML, and the various XML files.
Yes, you can, however using a plugin for a given IDE, helps you by not needing to swap from the IDE to another tool ( for testing for instance )
Here's the demo of IDEA
http://www.jetbrains.com/idea/training/demos/GWT.html
The same way you can also compile from the command line ( I do it sometimes ) or let the IDE help you by pressing a single button.
Doesn't the GWT Eclipse plugin provide the debugging capabilities? GWT debugging in eclipse is the most useful tool ever.
There also is a plug-in for MyEclipse that gives you a Matisse-like drag and drop Toolbox for GWT.
For Netbeans we have the GWT4NB plug-in, which offers among other things good debugging and code completion which works also for .ui.xml files.
OK ...
GWT RPC - With Google plugin, it does reduce the tedium verifying the interface RPC interface-async pair declaration.
UiBinder. Each uibinder set is a pair of files: The ui template and the template bean. The plugin helps me verify the correspondence of uifields in the template and the template bean. Then there are #uifactory, #uifield(provided=true).
You can declare another an "external" bean (a java code other than its template bean) using ui:with in the ui template. With that you pull in functions from the bean to provide values for your gwt widget attributes. The plugin provides me with auto-complete/verification of functions that are visible in ui:with bean.
Of course, the plugin provides the compiler too, which compiles the java code into javascript.
The debugger which works with the client-side. Imagine how the plugin works when we step the debugger on the client code which is compiled to javascript.
The run config, which automatically fills in the blanks, the args and params. I would hate writing a gwt launch config by myself.
Without the plugin, GWT development would be rather tedious.

Categories

Resources