glassfish验证@Webservice调用

时间:2011-07-18 15:18:41

标签: java web-services security glassfish-3

我们在glassfish v3.01中部署了一个java ee 6应用程序,我们希望将一些EJB作为Web服务公开,但是我们在保护和验证Web服务端点时遇到了问题。我们正在使用自定义登录模块和领域。我们如何验证Web服务调用?

由于 吉丁

@WebService
@Stateless
@DeclareRoles({Role.WEBMASTER, Role.ACCOUNTADMIN, Role.ACCOUNTUSER})
@RolesAllowed({Role.WEBMASTER,Role.ACCOUNTADMIN,Role.ACCOUNTUSER})
public class SmppService
{
    @EJB
    private SmppEjb ejbRef;// Add business logic below. (Right-click in editor and choose

    @WebMethod(operationName = "sendMessage")
    @Oneway
    public void sendMessage(@WebParam(name = "cellNumber")
    String cellNumber, @WebParam(name = "message")
    String message) {
        ejbRef.sendMessage(cellNumber, message);
    }

}

1 个答案:

答案 0 :(得分:0)

用户名和密码放在http标头中。所有soap客户端都应该有一种方法来指定它。例如,在我们使用soap4r的ruby代码中,它看起来像这样

instance = eval(@gateways[gateway]).new(url)
instance.options["protocol.http.auth"] << [url, @auth_data[user][0], @auth_data[user][1]]
instance.options['protocol.http.ssl_config.verify_mode'] = OpenSSL::SSL::VERIFY_NONE

@auth_data [user] [0]是用户名,@ auth_data user是密码。

如果您手动创建标题,则必须使用Digest Access Authentication

相关问题