创建 Axis2 Rampart 客户端时出现问题
我正在使用 Axis2 创建一个 Web 服务,该服务使用 Rampart 进行身份验证。在 Rampart 的所有示例中,客户端需要有 Axis2 的客户端存储库。 Rampart 在客户端上启动,如下所示:
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("path/to/client/repo", null);
SecureServiceStub stub = new SecureServiceStub(ctx,"https://localhost:8443/axis2/services/SecureService");
ServiceClient sc = stub._getServiceClient();
sc.engageModule("rampart");
createConfigurationContextFromFileSystem 方法需要客户端上具有 Rampart.mar 文件的 Axis2 存储库的路径。它显然需要完整的绝对路径,而不是相对路径。
但是,我正在使用 Java Web Start 部署客户端,并且无法在可能需要运行客户端的每台计算机上放置 Axis2 存储库。它需要通过网络浏览器在任何机器上工作,因此客户端需要的所有内容都在 jar 中。有什么方法可以从客户端应用程序的 jar 加载 Rampart.mar 文件吗?
另一种可能性是使用 ConfigurationContextFactory.createConfigurationContextFromURIs 方法,但这需要我在服务器上创建 axis2+rampart 的在线存储库。有人知道这方面的好指南吗?我仍然更愿意将所有东西都打包在罐子里。
I'm creating a web service using Axis2 which uses Rampart for authentication. In all the samples for Rampart, the client needs to have a client side repository for Axis2. Rampart is started on the client as follows:
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem("path/to/client/repo", null);
SecureServiceStub stub = new SecureServiceStub(ctx,"https://localhost:8443/axis2/services/SecureService");
ServiceClient sc = stub._getServiceClient();
sc.engageModule("rampart");
The method createConfigurationContextFromFileSystem needs a path to an Axis2 repo on the client which has the rampart.mar file. It apparently needs a full absolute path, not a relative path.
However, I'm deploying my client with Java Web Start and I can't put a Axis2 repo on every machine that may need to run the client. It needs to work from any machine from a web browser so everything the client needs to be in the jar. Is there any way I can load the rampart.mar file from the jar of my client app?
Another possibility would be using the ConfigurationContextFactory.createConfigurationContextFromURIs method, but this would require me to create an online repo of axis2+rampart on the server. Anyone know of a good guide for this? I still would prefer to just package everything in the jar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不需要 Axis2 存储库(我总是发现 Axis2 客户端就是这种情况),那么您可以使用以下命令加载没有存储库的 ConfigurationContext(请注意我在代码注释中添加的额外详细信息) ...
If you don't have a need for an Axis2 repository, which I've always found to be the case with Axis2 clients, then you can load a ConfigurationContext without a repository using the following (note the extra detail I add in code comments)...