English 中文(简体)
通过与SOAP基的@Stateless EJB进行长时间投票,以@Webservice
原标题:Implementing long polling with SOAP-based @Stateless EJB exposed as @WebService

我有一个以前存在的以SOAP为基础的网络服务,我要提供一种基于污染的长期通知系统。 我如何执行? 客户目前是贾瓦 desktop desktop desktop富客户,必须从其他相关客户那里得到更新。 服务器是玻璃天花。 我有一个基本障碍——www.WebMethod,但我因使用而遇到问题。 这里有一些显示网络方法概念的假体编码:

@WebService(serviceName="mywebservice")
@Stateless
public class MyWebService {
    @WebMethod
    public String longPoll() {
         short ct = 0;
         while(someCondition == false && ct < 60) {
             sleep(1000);  // 1 sec
             ct++;
         }
         if (someCondition)
             return "got value";
         else
             return "";
    }
}

在客户方面,我 calling声地利用未来目标:

public Future<?> requestLongPollAsync(Date lastUpdate, 
            AsyncHandler<LongPollResponse> handler) {
    try {
        return mywebservice.longPollAsync(getXMLGregorianCalendar(lastUpdate), 
            handler);
    } 
    // ...
}

客户方面似乎在工作。 然而,我有两个问题产生于这个问题,这似乎是由于网络服务呼吁的持久性质:

  1. Each requester uses an active http listener, so this is not scalable,
  2. When the client disconnects, GlassFish throws an exception (SSL exception, as all calls must go through the secure SSL listener (by default, http-listener-2)).

我是否需要使用 com。 EJB3.1 @Asynchronous annotation do any here? 我发现的所有例子都依赖Serlet AP、AJAX和其他不适用的技术。 谢谢。

问题回答

考虑采用日本宇宙航空研究开发机构-WS 2.0同步方案编制模式(很可能是你情况下的反馈客户)。 以下是一些资源:





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签