File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rampart at the client side

 
Arundhathi Menon
Ranch Hand
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using rampart for WS security in my app.

I have placed the rampart.mar including the rampart jars in my WEB-INF/lib folder. For some reason , it doesnt seem to be able to read the file from the classpath. Please let me knwo what needs to be rectified. I do not want to point to a folder outside my app and want to pack in rampart along into my WAR file.



Thank you.

Regards
Menon

 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have placed the rampart.mar including the rampart jars in my WEB-INF/lib folder.

*.mar files don't go into WEB-INF/lib - they go into WEB-INF/modules. And since *.mar files don't contain any jar files, all the jar files that come with Rampart need to go into WEB-INF/lib. (For Rampart 1.4 that would be opensaml-1.1.jar, rampart-core-1.4.jar, rampart-policy-1.4.jar, rampart-trust-1.4.jar, wss4j-1.5.4.jar and xmlsec-1.4.1.jar).
 
Arundhathi Menon
Ranch Hand
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,

Thank you for you quick response.

Will I have to pass this path as well? I am using the following method



where path is null and the axis2xml file is specified.

Since path is null , it looks for it in the classpath. So if I am to place the *.mar file in the WEB-INF/module directory , will it automatically look it up? I mean , is it like a default path?

 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, I completely missed that you were asking about the client side. The client would of course NOT look automatically in WEB-INF/lib for jar files, so you'd need to add all of those to your classpath in some other way.

I don't know what's required to engage Rampart programmatically - I always engage it declaratively.
 
Arundhathi Menon
Ranch Hand
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf , for pointing that out.

Is packaging the rampart.mar file directly under src folder considered a good practise?

Am keen on bundling it all up in the app and am trying to figure out the best way to do it.

Or better still , do you think the class path attribute when I build the WAR file can be tweaked to accomodate these files n the classpath?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I'm confused. You mentioned "client side", but you keep talking about war files - is that web app a *WS client* or the *WS server*?
 
Arundhathi Menon
Ranch Hand
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Rampart on the client side.

My Web App is a consumer of a Web Service which requires Rampart for client authentication. Hence inorder to fire those web service calls , I need to package Rampart.mar in my WAR file.

I though all files under WEB-INF/lib would be loaded by the classloader and hence be on the classpath.

Seem to be runnning into issues configuring this
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I though all files under WEB-INF/lib would be loaded by the classloader and hence be on the classpath.

Yes, but *.mar files are not *.jar files - they are accessed by the Rampart classes, not by the JRE classloader. I would imagine that one of the Rampart classes/methods you're using to set it up takes as a parameter the directory where it should look for *.mar files.
 
Travis Hein
Ranch Hand
Posts: 161
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yea, that really bugs me how the only way to initialize rampart is to specify file system path.

if you invoke the axis2 client from inside a servlet, where you have the ability to get a handle of



if not invoked from a servlet, perhaps an initial context listener, to interrogate the servletContext and jam the path into a JNDI, or application variable to be consumed later where you do the webservice client stuff.
 
Arundhathi Menon
Ranch Hand
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Travis.
 
Louis Amstutz
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resurrecting this thread because I have the same problem. My client will be run from a browser with Java web start, so I can't really put a rampart repo with the rampart.mar on the client's machine. I would really like to have the rampart.mar in the jar file of the application. Does anyone know of a way to do this?
 
Travis Hein
Ranch Hand
Posts: 161
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess your applet could on boot up do a fetch, such as from URL the rampart and addressing mar files, and then stuff them into a local temporary folder.

for example.
* create a temporary folder on the local machine (e.g. File.createTempFile)
* pull down the mar files from the URL on the server into these machines.
* configure the axis2 context to refer to this temporary folder as the modules folder.

Other than that, I guess it might be possible to instruct axis2 to use a custom URL class loader which would load the modules directly from the URL, but doing that is not clear to me at this time.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic