wood burning stoves 2.0*
The moose likes Web Services and the fly likes Unable to get Rampart setup correctly with Axis2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Unable to get Rampart setup correctly with Axis2" Watch "Unable to get Rampart setup correctly with Axis2" New topic
Author

Unable to get Rampart setup correctly with Axis2

Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
I'm following Ulf's security tutorial located at http://www.javaranch.com/journal/200709/Journal200709.jsp#a3

After much hunting, I managed to find Rampart 1.4 which I'm using with Axis2 1.4.1 I have Tomcat 6.0.18 and Axis2 integrated with Eclipse 3.4. So my versions and setup are a bit different than listed in the article.

I copied rampart-1.4.mar into the WEB-INF/modules directory as per the article. However, it lists in Axis2 as a faulty module. addressing-1.4.1.mar is already in the directory.

Speaking of which, I thought the ws security stuff was already included in the base Axis2 install?

When Tomcat started, I got a class not found exception for org.apache.rampart.Rampart So I'm assuming it can't find the Rampart jars. Do I need to copy the jars over as well? The tutorial only mentions copying over the mar files.
[ October 15, 2008: Message edited by: Bai Shen ]
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
I ended up finding the missing classes in the rampart jars and copying them into the WEB-INF/lib directory. I'm not quite sure why I needed to do this, as it's not mentioned that Ulf did it in his tutorial.

Is there a way to do this without copying all of the jars?

The only other Tomcat/Axis2/Rampart setup article I found said I should do a bunch more steps, such as download things from bouncycastle.
[ October 15, 2008: Message edited by: Bai Shen ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
I thought the ws security stuff was already included in the base Axis2 install?

It's not. Where did you get this impression?

I ended up finding the missing classes in the rampart jars and copying them into the WEB-INF/lib directory. I'm not quite sure why I needed to do this, as it's not mentioned that Ulf did it in his tutorial.

You're right, it's only mentioned explicitly in the first article (which is linked from the one you read, and described as recommended reading). But apparently you didn't need long to figure this out :-)

Is there a way to do this without copying all of the jars?

Since those libraries are required, no. But that's one-time setup, so it shouldn't be a big deal.

The only other Tomcat/Axis2/Rampart setup article I found said I should do a bunch more steps, such as download things from bouncycastle.

Not sure which article you read, but the BouncyCastle stuff is only needed for encryption, not authentication (which is what the article you mentioned is all about).
[ October 15, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
It's not. Where did you get this impression?


Dunno. Pretty sure I read it somewhere.

You're right, it's only mentioned explicitly in the first article (which is linked from the one you read, and described as recommended reading). But apparently you didn't need long to figure this out :-)


I wouldn't call it explicitly mentioned. I just went back and reread the first article. You mention copying the WSS4J jars into the lib folder. While it's fairly easy to correlate, I still wouldn't call it explicit.

Since those libraries are required, no. But that's one-time setup, so it shouldn't be a big deal.


I was mostly trying to figure out if there was an automatic integration method. Right now, every time I want to include Rampart with a project, I have to manually copy over all of those jars, whereas Axis2 automatically sets itself up.

Not sure which article you read, but the BouncyCastle stuff is only needed for encryption, not authentication (which is what the article you mentioned is all about).


It was in an article over at the wso2 site. It was linked from the Rampart page. As for the encryption, that's next on my list once I figure out the authentication. Already saw your article on it.

Oh, and here's the link to the article I mentioned.

http://wso2.org/library/knowledge-base/run-rampart-samples-apache-tomcat

All the articles I've been finding are how to manually integrate Axis2 and Rampart. I'm still trying to find something that will let me automatically do it. I figure if I have all these tools available, I should make more use of them.
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Okay, so I got my server all set up and configured. Now I'm trying to write a client to connect to it. I created an Axis2 client from the wsdl and when I connect, I get told I don't have the security header. So according to the following article, I need to engage rampart. But when I do so, it just tells me that it can't engage. I'm assuming that I'm missing the jar files, but I can't figure out which ones.

http://wso2.org/library/3190#Step_3._Engaging_Rampart_and_setting_authentication_information

EDIT: Evidently not. I added all the jars from the Rampart lib dir and it didn't change the error. Also, is the WSDL supposed to be different when using security?
[ October 17, 2008: Message edited by: Bai Shen ]
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Okay, I finally got it to register Rampart. However, it doesn't seem to be including the security header for some reason.

I'm not using https, so I didn't do the cert configuration.
Bai Shen
Ranch Hand

Joined: Sep 24, 2008
Posts: 323
Okay, I finally got it to work. I had to do a bunch of stuff that was weird IMO, so I'm gonna go do some more research. The biggest issue is that Ulf's stuff uses axis2.xml while the article link I listed earlier does it programmatically(as far as I can tell).

The server setup was fairly simple and straightforward. I had to copy over the rampart mar and jar files. I also had to go into the services.xml and engage the rampart module.

The client side was a huge pain. Firstly, the differences between Axis and Axis2 threw me off, so it took a bit to get a normal client working. I had to create a modules dir and add the addressing and rampart mar files to it. Then I created a context from the file system pointing at the modules dir.

Now in the article I listed earlier, they don't pass in a configuration file. Instead they set the user/pass programmatically using options. However, I couldn't get that to work. Instead, I ended up copying over the default axis2.xml file to a conf dir, and pointing the context at that. Then I added in the outflow security piece to connect to the PWHandlerClient.

So now I have a password handler class on the client and the server. Which is what I wanted, as now I can do the password lookup however I choose.

While this whole process has been a pita, I have learned a lot about the workings of Axis2 and Rampart. Still got a ways to go, though.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to get Rampart setup correctly with Axis2
 
Similar Threads
Combining JAAS and SOAP in a log on system
implementing encryption of SOAP messages.
How to learn WS*?
Adding WS Security Info to Soap Header
WS Security with Axis