简体   繁体   English

将Web服务客户端放在Tomcat中的Maven Web应用程序中的axis2中

[英]put a web service client in axis2 inside a maven webapp in tomcat

I need to consume a secure webservice from inside my webservice deployed in axis2-tomcat. 我需要从axis2-tomcat部署的Web服务内部使用安全的Web服务。

my problem is with the resources I need to consume the secure webservice. 我的问题是需要消耗安全Web服务的资源。 for example in a class that act as a client for this secure web service i can do this: 例如,在充当此安全Web服务的客户端的类中,我可以这样做:

        System.setProperty("javax.net.ssl.trustStore", "keys\\store.jks");

Or 要么

          sc.engageModule("rampart");

But if I put this class inside my webservice how i can find this resources that I have inside my webservice of course. 但是,如果我将此类放在我的Web服务中,那么如何才能找到我在Web服务中所拥有的资源。

Any tips. 有小费吗。

To read resources(property files or trustStore file or else) from the servlet you may use: 要从servlet读取资源(属性文件或trustStore文件或其他),您可以使用:
getClass().getClassLoader().getResourceAsStream()
Like: 喜欢:

Properties props = new Properties();

InputStream is =
getClass().getClassLoader().getResourceAsStream("someResource.properties");

props.load(is);

BTW BTW
To call a secured webservice you may see Apache CXF Conduit , that will serve the easy way. 要调用安全的Web服务,您可能会看到Apache CXF Conduit ,这将以简单的方式提供服务。
At lest if you dont want to use CXF, The part Configuring SSL Support will give you ideas. 至少,如果您不想使用CXF,“ Configuring SSL Support ”部分将为您提供一些建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM