How to include a java page in asp.net response? - java

I am using an asp.net webapp for a business application. I need to address a new requirement which requires this webapp to
Share user context with a third party java webapp.
Include java webapp page response as part of .net app response.
How do i achieve this? I cannot use an iframe in my .net response because if i do, the user's browser will have to send a request for the java webapp - it has to be a server side include/ forward. The only solution i can think of at this point is opening a url connection on server side to the java webapp and posting data to it, but what i dont like abt this solution is that it is not very scalable.

If you have a java application (packaged in jar), you can use IKVM to convert that into .NET dll or exe that can be used in .NET web or windows application.
Java files are compiled through javac.exe and run through java.exe, now in order to invoke these two exe you need to use System.Diagnostics.Process class and pass the java file (to javac.exe for compiling) or class file (to java.exe to run the application) as a parameter to Process class
http://www.csharp-station.com/HowTo/ProcessStart.aspx
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx
Go through the given tutorial at IKVM website.
Also see this Java.NET : Integration of Java and .NET

Related

How can i export gwt project to external web server?

I have created a web application using google web toolkit, it works fine launching it from eclipse. I want to put it on my server so I compile it with gwt compile and put the war folder on server. Client works well but the rpc calls return "not found error" on javascript console. I feel like i missed one step: maybe I should launch java server for rpc first, but i don't understand how to do it.
GWT-RPC requires a servlet container: Tomcat, Jetty, etc.
If your "server" is Apache HTTPD, Nginx, Lighttpd, etc. then it's not enough.
An alternative is to not use GWT-RPC so you can code your server-side in another language (PHP, Ruby, etc.) That requires much more work on GWT's client side though.

For J2EE project to run on different Computer what does it need?

I know for a Java Program to run on another Computer it needs JRE(Java Runtime Environment). But for a J2EE application (Serlvet-JSP) or Struts2 framework application or Hibernate framework application or any Framework application of Java what are need to Run it Successfully on another computer where it is not developed....
I know JRE is required for both type of Application. and JDK is for developing an application.
I also know that for Mobile application to run on device it needs an Emulator that supports the particular OS (Android, iOS, etc). Just like an Standalone Java Application.
But for running J2EE application is there any other requirements than JRE??
For Example:- I have made a site called SocialMash.com I want to have a working prototype to deliver to user (User meaning like we all use Stackoverflow and other sites). What will I require to configure the site.
I know I will require a server like Tomcat/JBOSS/GlassFish but that all will be on my side (server side/ development side) but Do the Users to use the site will require anything among JDK, JRE, Server, or anything to use SocialMash.com or just URL will be enough?????
You need to have a JavaEE application server. It runs on top of JRE. You can check this open-source reference implementation (full-profile, my favourite):
https://glassfish.java.net/
or if you want to have only web-profile:
http://tomcat.apache.org/download-80.cgi
Web profile is different from full profile in that web profile supports only Servlet-JSP, but not JPA (or hibernate as stated in your question).
Users will not require anything except for the browser in case you write a web application (Servlets+JSP, Struts, JSF, etc. - just give them a web reference). But you can go further than that. You can write a Java SE desktop client for EJB, or SOAP service (they will be placed in full-profile server like Glassfish), and distribute for your customers. In this way they will not require any browser, but your custom desktop program.
Some of the libraries require to be added to your application server and configured manually. Like Struts. In this case you first need to decide which framework/library you would like to use, then go to their web site, and follow the tutorial on its installation.
To host an J2EE application, a webserver is required that has servlet container. servers included in XAMPP/LAMP/WAMPP will do for php based application. But for J2EE application servlet container is rquired which is there in TOMCAT/GLASSFISH/JBOSS.
On the user side, the user sees pure HTML with additional js/css. He does not see the jsp scriplets/servlet code written in your J2EE application. so no java technology is required on the user system. He only needs a browser.
A J2EE project intends to create a web service. In order to run this project on your computer, you need a local server.
Any IDE can provide you a local server like Tomcat or Glassfish, you just need to try to run this project to get these options.
If you don't need to access the code on the other computer, two options:
You compile your project to get a .war file, which you can deploy on your Tomcat server, or any else.
You put this on a server of yours, and share the url.
Assuming that you are in charge of the app hosting:
If that the app is running on your own remote server, you just need to share the app url and your user can access it with his browser (nothing more is needed).
If you run it in your own computer, as localhost, he won't be able to access it, and I recommand the usage of a host like Openshift to make it accessible (that's a free solution).

Standalone Java application with HTML front end

I want to develop a standalone java application, with web browser as front end. This application will run locally and won't be making any remote server calls. I'm essentially using java, as web-browser cannot perform file operations.
I want this application to be portable: no need of installation. Just copying a folder should be enough. I want to know how it can be done, how will javascript communicate with java code.
In continuation of #Quentin's answer.
Yes, you need web server.
There are 2 principal architectures:
Create stand alone application with embedded web server
Create ordinary web application and run it on proprietary web server.
IMHO I think that the second approach is better, however it strongly depend on your application functionality.
You can take jetty or grizzly as a web container. Both can run as in embedded or stand alone modes. You are welcome to share other details of your application with the community if you need concrete advises concerning to the design of your application.
The application would need to implement an HTTP server. Then all communication would be done over HTTP.
Write a small web application as you need and Deploy it using Jetty. Jetty is a pure Java-based HTTP server and Java Servlet container. You can use it by embedded mode also.
Deployment is so easy if you use Jetty-Runner
java -jar jetty-runner.jar my.war
You don't need a local web server. Take JavaFX (embedded webkit) and implement a URL protocol handler for say "myprotocol". Then you can access it from the browser using something myprotocol://xxx.yyy.zzz

consume my SOAP web service through my java applet

I create a simple SOAP web service and I want to consume it using java applet....meanwhile I'm not sure if that is possible or not. so my question is how to add this applet in HTML page and make it consume the web service also. Does I have to take the web service generated sources and put them some where or I have to modify my normal applet tag.....
There is no need to treat the generated source files any differently than your regular source files. Simply copy the generated source files into your current project.
It is possible...it is like using it from a normal swing application cause you do not access local resources from the hosting computer.
Just bundle client code ...and will work.
I assume SOAP call is to a machine NOT different than that supplying the applet

Can DLL talk to Java webservice?

Can a DLL plugin inside Internet Explorer at the client side, communicate with Java webservice at the server side?
The DLL is a BHO that captures URL and send it to server in XML format.
Please advice..
A native (DLL) plugin does not execute inside a security sandbox, and can do anything that the host application (i.e. IE) can do ... including connecting to any accessible remote server.
Of course, for this to happen, the user has to install the plugin. (And this sort of thing is why users should be very cautious about installing plugins!)
Yes, web services and XML nicely work with different programming languages, operating systems etc.

Categories

Resources