可以在 .NET (C#/VB) 中打开/操作 Java Web 应用程序吗?
我使用 Java Web 应用程序 (app/截图,你需要注册,但它只是一个java网络应用程序),但是我想要在 .NET 应用程序中自动化其功能(C# 或 VB,没关系,我更喜欢 C#)。
我尝试过搜索,但不幸的是“Java web”、“.NET”和“C#”等,没有给我返回任何有用的东西。是否可以在 .NET 应用程序中的控件内(或通过其他方式)加载页面,从而对显示本身进行操作(数据流将被加密,因为它是 https - 所以我不知道我是否可以能够读取传入和传出java应用程序的数据,我认为不能,但能够读取应用程序会很好),能够选择区域、单击、读取/输入数字和文本等。
我意识到这是一个相当广泛的问题,但是,如果有人可以针对这个问题提供一些建议/见解,那将会非常有帮助。
编辑添加:我想更好的问题是“使用 Windows api 与 java web-start 应用程序交互的方式?”或者“可以在.NET应用程序中包含java web-start应用程序,并直接与web应用程序的组件交互”
我也想知道是否可以将其以.NET形式加载到浏览器中,尽管我认为它只会启动网络启动,使其脱离表单控制。
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 functionality 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道我是否有您正在寻找的答案,但我相信 REST 旨在解决开发人员希望通过另一个平台访问遗留功能的问题。
如果通过 REST 接口公开所有 Java 功能,则可以构建一个通过 REST 使用这些资源的 .NET 应用程序。但它并不能解决将所有内容转移到 .NET 的问题。要迁移到 .NET,您需要重建整个应用程序。
如果这确实是您的目标,那么 REST 将让您使用 .NET 继续前进,其中新功能可以在 .NET 中开发,而旧功能可以无限期地保留在 Java 中或以小型、可管理的阶段进行移植。
.NET 和 Java 都有一些框架允许您公开 REST 接口并安全地使用该 Web 服务。
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.
您应该能够隔离小程序或对象标记,并使用参数在独立小程序查看器中启动小程序。
如果小程序使用 javascript 网关与浏览器交互以进行身份验证或其他目的(因为 javascript 网关仅在浏览器中可用),则可能会失败。
一旦您能够在浏览器外部运行小程序,您就可以尝试在自己的进程中启动它,可以通过嵌入 JVM 或运行您自己的 java 代码,因为 appletviewer 只是初始化一个小程序类,您可以这样做你自己。
一旦完成,您就可以相对容易地进行屏幕抓取和控制。
查看 java.awt.Frame.getFrames() 以访问屏幕上显示的所有窗口。
这使您可以访问组件层次结构,即输入字段、按钮和其他组件。
祝你好运!你会需要它。
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.