Possible to open/manipulate a Java Web App in .NET (C#/VB)?
I use a Java web app (app/screenshot, you'd need to sign up, but it's just a java web app), however I'd like to automate its funct开发者_C百科ionality inside of a .NET application (C# or VB, doesn't matter, I'd prefer C#).
I've tried searching but unfortunately "Java web" and ".NET" and "C#" etc, don't return me anything even remotely useful. Is it possible to load the page within a control (or through some other way) within a .NET application, and thus act upon the display itself (the data flow will be encrypted, since it's https - so I don't know if I'd be able to read the data coming to and from the java application, I assume not, but being able to read the application would be nice), to be able to select areas, click, read/input numbers and text, etc.
I realize this is a pretty broad question, but, it'd be very helpful if someone could offer some advice/insight into this problem.
edit to add: I guess a better question would have been either "Ways to interact with a java web-start app with windows apis?" or "Possible to contain a java web-start app within a .NET app, and interact directly with components of the web app"
I'm also wondering if it will be possible to load it into a browser in a form in .NET, although I assume that it would just launch web-start taking it out of the forms control.
I don't know if I have the answer that your looking for, but I believe REST was designed to solve problems whereby a developer wants to access legacy functionality through another platform.
If you exposed all of the Java functionality through a REST interface, you could build a .NET application that consumes those resources through REST. It won't solve your problem of moving everything to .NET though. To move to .NET you are looking at rebuilding the entire application.
If that is indeed your goal, then REST will let you walk it forward with .NET where new functionality could be developed in .NET while old functionality can remain in Java indefinitely or be ported over in small, manageable stages.
There are frameworks for both .NET and Java that will allow you to expose a REST interface and consume that web service securely.
You should be able to isolate the applet or object tag and use the parameters to start the applet in the stand-alone appletviewer. That might fail, if the applet is using the javascript gateway to interact with the browser for authentication or other purposes (as the javascript gateway is only available in the browser).
Once you are able to run the applet outside the browser, you can then try to start it within your own process, either via embedding the JVM or by running your own java code, because appletviewer is just initializing an applet class, which you can do yourself.
Once that is accomplished, you can do screen-scraping and controlling relatively easy. Check out java.awt.Frame.getFrames() to get access to all windows displayed on the screen. This gives you access to the component hierarchy, i.e. the input fields, buttons and other components.
Good luck! You will need it.
精彩评论