File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Troubles with wss4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Troubles with wss4j" Watch "Troubles with wss4j" New topic
Author

Troubles with wss4j

Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
Working through the turorials Axis Deployment Tutorial and Axis Deployment Examples has turned out to be desasterous for me. I had a really hard time understanding them. I have no idea what or why I am doing something. Then when the code did not work, I had no idea how to fix it.

I ran into all of the problems in this posting WSS4J problem in Axis

But I continue to get errors. Here is the xml I am sending:



When I redeploy the service without the security constraints I get this back:



When I redeploy it with security turned on I get this error:


Any ideas?


The squeaky wheel gets the grease. Well, that or replaced...
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
is that the complete error message ? can you see any error description along with it ? like at what line/stage/java file etc.,
Thank you.


Spritle Software Blogs
Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
Nope. That is all there was. I have been banging my head against the wall trying to figure this out. There was nothing in the logs either. In an effort to "gain more control" I have decided to try to extend WSDoAllReceiver. This appears to be working better. Then I can parse the Header myself. But I feel I am rewriting something that is already done. If I could just figure out how this framework works. Or rather, make it work without generating errors...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
Do you have WSS4J running on the server? The error message seems to be coming from Axis, not WSS4J. Did you have nay problems running the examples?


Ping & DNS - my free Android networking tools app
Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
I am using Axis. Axis is happy and all Axis examples run without problems. I had a difficult time running the wss4j examples. I was getting this same error. So I decided to try and roll my own.

I have tried to track this down. I went to the top of the stack.

-> org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:473)

This was were a RuntimeException was caught. After some more investigating, it looked like this was failing on parsing the soap header. But the lack of logging and commenting makes it really difficult for me to read through it. And on top of that documentation ( examples, how to docs, tutorials, etc ) are very limited. The ones I do find don't help much.

I ended up writing my own subclass of WSDoAllReceiver. I learned a ton about the framework ( and WSDoAllReceiver ) in doing this. I have a class that works ( the beginnings of a prototype ). But it is limited in features. I hope to work my way back to WSDoAllReceiver so I can find out what I did wrong.
Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
I wrote my own WSDoAllReceiver. In the process I leaned a lot about the framework. But the examples still would not work. I tracked that down. I got a very generic error with no clue as to why it will not work. See the exception above.

The problem is in the tutorial you are told to use this in the first tag in the header:



That is incorrect. It should be this:



Arg! They had me using the wrong namespace! Appreciate this find. It tooks me hours and a lot of source code diving and trial-and-error coding to find this. Hopefully it will save you some.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
I'm curious - why are you generating the tags yourself? I've always let WSS4J generate the actual SOAP elements; do you have a case where that doesn't work?
Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
I was following the tutorial. They said use those tags so I did.

Our clients are not always going to be able to use Axis. Our clients could be .Net, PHP, PERL, Java, or anything else you can think of. Hopefully they will use the WSDL to generate the tags. No guarantees though. The client I am using allows me to paste any xml into a field and then send it to a url. This works really well if you have to make small tweeks to the xml or you want to try different things.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41634
    
  55
WSDL does not generate messages - it prescribes how messages should look like, but they are generated by some other means. If you have a WSDL description of your service, then you should not accept anything that does not conform to it.

WS-Security is a cross-platform standard, with WSS4J being the standard Java implementation. You should not have problems using other languages WS-Security facilities to connect to a WSS4J server, or vice-versa. Generating SOAP (and its more complicated variants like WS-Security) by hand seems a bad idea.
Rusty Enisin
Ranch Hand

Joined: May 26, 2005
Posts: 107
Never thought WSDL itself generated the tags. But something else will use the WSDL to generate code (WSDL2Java) that in turn knows how to generate the tags, no? Therefore I stick by my previous statement "Hopefully they will use the WSDL to generate the tags." Notice the "the" in "the WSDL". I did not write "they will use WSDL to generate the tags". WSDL is not a tool. I don't think I could have gotten this far if I did think it was a tool.

Now that we are officially way off topic. I understand you must find a lot of inquisative idiots in this forum. I must appear to you to be the same. Let's not treat each other that way. I appreciate your help. But doing this will lead us nowhere.

Now, as for "hand coding" the SOAP. I did that only for the tutorial. In no way will that make it to production. It was a convenient way to follow the tutorial. I am not quite to sure why I am being tested on this. Again, here we are way off topic.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Troubles with wss4j