有没有办法通过注释在metro中实现ws-security?

发布于 2024-11-06 15:42:16 字数 174 浏览 5 评论 0原文

由于我不想创建大量 wsit 文件来启用安全性(消息加密和用户身份验证)并且我不想使用 netbeans 在那里使用 Metro 插件,所以我想问是否有任何简单的方法通过注释实现 ws-security? 或者除了soap ui之外还有任何eclipse插件来创建这样的wsit文件吗?实际上这不是很有用?

提前致谢。

Since i do not want to create a lot of wsit files to enable security (encryption of message and authentication of users) and i do not want to use netbeans to use the metro plugin there, i want to ask if there is any easy way to implement ws-security via annotations?
Or is there any eclipse plugin besides soap ui, which is in fact not very usefull, to create such wsit files?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缘字诀 2024-11-13 15:42:16

根据 这篇文章,Metro 不以编程方式支持 ws-policy。不过那是2009年了,所以我不知道情况是否仍然如此。

如果您不想使用 wsit 文件(也就是说,如果您在 WSDL 中有策略),Metro 也可以直接从 WSDL 获取策略。

这就是我在 Metro 生成的服务类中所做的。它直接从 WSDL(位于我的类路径中)加载策略,并将在运行时应用所有策略,前提是您已在应用程序服务器中安装了 Metro 并且项目中没有任何冲突的依赖项(这个有点对我来说找到一个麻烦,我的一些依赖项有 jaxws-rt 作为依赖项,这可能会破坏 Metros 策略解析)。

private final static URL CUSTOMERSERVICE_WSDL_LOCATION;

static {
    CUSTOMERSERVICE_WSDL_LOCATION =
        CustomerService.class.getClassLoader().getResource("Customer/CustomerService.wsdl");
}

public CustomerService(URL wsdlLocation, QName serviceName) {
    super(wsdlLocation, serviceName);
}

According to this post, Metro does not support ws-policy programmatically. That was 2009 though, so I don't know if that's still the case.

Metro can get the policy directly from the WSDL too if you don't want to use wsit files (if you have the policy in the WSDL at all, that is).

This is how I did in my Metro-generated service class. It loads the policy directly from the WSDL, which is in my classpath, and will apply all policies in runtime, provided that you have installed Metro in your application server and don't have any conflicting dependencies in your project (this one was a bit of a hassle for me to find, some of my dependencies had jaxws-rt as a dependency, which may ruin Metros policy resolving).

private final static URL CUSTOMERSERVICE_WSDL_LOCATION;

static {
    CUSTOMERSERVICE_WSDL_LOCATION =
        CustomerService.class.getClassLoader().getResource("Customer/CustomerService.wsdl");
}

public CustomerService(URL wsdlLocation, QName serviceName) {
    super(wsdlLocation, serviceName);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文