根据 javadoc:
指示给定的@WebMethod 只有输入消息而没有输出。通常,单向方法在执行实际业务方法之前将控制线程返回给调用应用程序。如果标记为 @Oneway 的操作具有返回值或 Holder 参数,或者声明任何已检查异常,181 处理器应报告错误。
那么我是否可以假设,如果我需要异常处理(选中或未选中),则不建议使用此注释?我不会从业务逻辑中返回任何内容,但是我仍然有兴趣了解超时和特定于调用 SOAP 方法的操作的其他各种错误。此注释是否意味着我无权访问 HTTP 返回代码或引发异常?
Question:我是否最好自己将其线程化以获得真正的异步调用,并删除@Oneway
注释?
@Oneway
means nothing永远不会逃脱你的方法,既没有响应也没有异常。这有两个原因:
So if you want to propagate exceptions or timeouts, use standard SOAP method with empty response* and few faults declared explicitly. If you want to timeout your call after some time, you'll need separate thread pool and blocking waiting for response gor a given period of time.
* please do not confuse empty SOAP response (an XML document with no content, just root tag, wrapped in a SOAP envelope) with empty HTTP response (nothing was sent back). Remember that SOAP is not limited to HTTP. For example if you use JMS or e-mail transport, empty response (or fault) of ordinary two-way function is yet another message being sent from server to client. one-way method is just one reauest message and nothing sent back.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)