Jorge Infante Osorio
Jorge Infante Osorio

Reputation: 2153

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.

my problem is with the resources I need to consume the secure webservice. for example in a class that act as a client for this secure web service i can do this:

        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.

Any tips.

Upvotes: 0

Views: 234

Answers (1)

Mohsen Heydari
Mohsen Heydari

Reputation: 7284

To read resources(property files or trustStore file or else) from the servlet you may use:
getClass().getClassLoader().getResourceAsStream()
Like:

Properties props = new Properties();

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

props.load(is);

BTW
To call a secured webservice you may see Apache CXF Conduit, that will serve the easy way.
At lest if you dont want to use CXF, The part Configuring SSL Support will give you ideas.

Upvotes: 3

Related Questions