JAX-WS - 如何禁用@WebMethod 上的自动响应?

JAX-WS - how to disable auto-response on @WebMethod?

是否可以在注解为@WebMethod的方法中只使用web请求而不响应? 或者在 ws 中我们应该总是得到响应而我需要其他东西? 看起来像

@WebMethod public void createUser( @WebParam(name="userInfo") UserInfo userInfo) throws MyException

在从 wsdl 生成的接口中。但是当我向服务器发送请求时,尽管方法无效,我还是得到了响应。

请问您能否推荐有关此主题的书籍。

提前致谢!

您可以使用 @Oneway 注释

@WebMethod()
@Oneway()
public void insertUser(String username) {
 ...
}

文档:

Indicates that the given @WebMethod has only an input message and no output. Typically, a oneway method returns the thread of control to the calling application prior to executing the actual business method. A 181 processor should report an error if an operation marked @Oneway has a return value or Holder parameters, or declares any checked exceptions.

以下 table summarizes 标准 JSR-181 注释,您可以在 JWS 文件中使用它们来指定 Web 服务的形状和行为