Websphere/JSP 中的服务器到服务器通信
如果这有点愚蠢,我很抱歉。我什至对 JSP/WebSphere 都不陌生。我正在与一家公司进行远程工作,该公司的服务器运行着他们所说的“环境”。
我需要他们的服务器直接向我的服务器发送 POST 请求(无需客户端干预)。我的服务器将回答一个 JSON 对象,该对象应该保存在他们的数据库中。
这个负责人只会写jsp页面。我想知道,是否可以做我需要的事情?
如果您能为我指出一些包含这方面信息的指南,我将不胜感激。我们在这里的时间已经不多了。
谢谢。
i'm sorry if this is a bit silly. I'm not even new to JSP/WebSphere. I'm working remotely with a company whose servers run this "environment" as they called it.
I need their server to send a POST request directly to my server (whitout client side intervention). My server will answer with a JSON obj that should get saved in their databases.
The person in charge of this is only able to write jsp pages. And I wonder, is it possible to do waht I need?
If you could point me to some guides with information about this, I would appreciate it. We are kinda running out of time here.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以简单地使用远程公司服务器上的两个 JSp 和您的服务器上的一个 JSP 来完成此操作,
让我们将它们命名如下,,
在 sendReq.jsp 中>,使用 HttpConnection 类发送 POSt 请求的代码
在 sendRes.jsp 中,生成 JSON 并作为响应发送到 saveJSON.jsp
在 saveJSON.jsp 中,从服务器获取 JSON 并将其存储到数据库的代码,
这有帮助吗?
You can do it simply with two JSps on the remote company's server and with one JSP on your server,,
lets name them as follows,,
In the sendReq.jsp, code to send a POSt request using the HttpConnection class
In the sendRes.jsp, code to make the JSON and send as response to saveJSON.jsp
In the saveJSON.jsp, code to get the JSON from the server and store to database,
Was this helpful!!
只有 JSP 站在他们一边,但没有客户端干预,这似乎是两个相互冲突的需求。当然,他们可以编写一堆脚本代码来在 JSP 中执行任何操作,但 JSP 直到需要呈现视图时才会执行。即客户请求它。
我想你可以通过让外部的东西访问他们的 JSP 的 URL,然后 JSP 又访问你的 JSON 提供服务的 URL 来解决这个问题。您可以使用 cron 之类的东西来安排初始 URL 请求。
Only JSPs on their side, but no client intervention seems like 2 conflicting requirements. They could, of course, write a bunch of scriplet code to do anything in a JSP, but JSPs don't get executed until a view needs to be rendered. i.e. a client requests it.
I guess you could get around that by having something external hit the URL of their JSP, which then in turns hits the URL of your JSON-providing service. You'd could schedule that initial URL request with something like cron.