在 WSDL 中指定安全策略信息是常见做法吗?
我们的团队正在使用 Spring-WS 和 XWSS 实现基于 SOAP 的 Web 服务。到目前为止,我们一直依赖 Spring-WS 从我们的 XSD 生成 WSDL。我们现在正在考虑是使用 WS-SecurityPolicy 在 WSDL 中记录安全要求,还是在单独的文档中传达它们。以下是我们正在思考的问题:
什么是常态?将策略放入 WSDL 中常见吗?
是否有许多(任何?)客户端生成器在 WSDL 中获取 WS-SecurityPolicy 信息?
Spring-WS 在生成 WSDL 时不支持 WS-SecurityPolicy。切换到 Apache CXF 对我们有帮助吗?
此外,我们知道 REST 越来越受欢迎,但 SOAP 已被当权者指定。谢谢!
Our team is implementing SOAP-based web services using Spring-WS and XWSS. So far we've been relying on Spring-WS to generate the WSDL from our XSDs. We're now considering whether to document the security requirements in the WSDL using WS-SecurityPolicy or conveying them in a separate document. Here are the questions we're pondering:
What's the norm? Is it common to put the policy in the WSDL?
Do many (any?) client generators pick up WS-SecurityPolicy info in the WSDL?
Spring-WS doesn't support WS-SecurityPolicy when generating the WSDL. Would switching to Apache CXF help us?
Also, we're aware that REST is gaining popularity but SOAP has been designated by the powers that be. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
希望这仍然可以帮助任何人。
是的,这很常见。
我不知道很多,我使用地铁,它确实根据安全限制生成客户端。
Hope this can still help anybody.
Yes, it's common.
I don't know about many, I use metro and it does generate clients according the security constrains.
因此,您可以执行以下操作,而且很简单:
1) 在您的项目中包含 cxf-bundle 库。如果您使用maven,您可以这样做:
2) 阅读 这里如何从 wsdl 生成 java 类。
3) 确保在 pom 文件中,指向正确的 wsdlLocation 以从 wsdl 生成 java 文件。
4) 初始化您生成的客户端并注入提供给您的用户名和密码。像这样的东西:
PS:请确保您有正确的库,我只使用了 cxf-bundle,没有使用 cxf 中的任何其他内容,并且它有效!早些时候它不起作用,因为我单独包含了来自 cxf 的库。
希望有帮助!
So here's what you can do and it is straightforward:
1) Include cxf-bundle library in your project. If you are using maven, you can do this:
2) Read here how to generate java classes from wsdl.
3) Make sure in the pom file, you point to the correct wsdlLocation for generating the java files from wsdl.
4) Initialize your generated client and inject username and password provided to you. Something like this:
PS: Please make sure you have the right libraries, I just used cxf-bundle and nothing else from cxf and it worked! Earlier it was not working as I had individually included libraries from cxf.
Hope that helps!!