Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CXF web service issue when using @WebParam (header=true)  RSS feed

 
Felix Mercader
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all. I need help here. I have at work a CXF web service working really well running in a WebLogic server. I recently was asked to pass some extra parameters (for extra authentication purposes). We want these extra parameters to travel in the header, not as normal parameters.

I have two different scenarios to explain. In fact, in scenario number 1, everything works really well, I am very please with it as my web service received the header parameters and I can validate them. But then, in scenario number 2, in running time, all these new parameters in the header are NULL (and normal parameters are correctly populated!). So I cannot validate the header ones. And I need scenario 2 to work as we want these extra parameters to be in the header.

Why this binding is not working in my second scenario ? there is a bug ? Am I missing something ? Please help me. Here I describe both scenarios with some code for clarification:

1) Here everything works fine. In my cxf-servlet.xml file I have the endpoint defined as:


And one of the calls that my CXF web service interface is offering is for instance this one where you can see that the 3 first parameters are header=true, not the others.


That's all. I don't think I need to show more. This is working fine. I deploy in WebLogic and my client or soapUI or debugging or whatever I do, the web service receives all these parameters and I can work with them.

2) The real endpoint I want to use in my cxf-servlet.xml is the following:


And the reason to use this one is because I need a "local" WSDL that I can edit and make changes. This "local" WSDL is the exact WSDL that WebLogic provided me after my first deployment plus adding things like this plus using them instead of type="xs:string":


This is, adding some restrictions so the WSDL will validate the user input. For instance 00000123 is a valid institution number but 000000XX is not.

This functionality works really nice. To be honest, it forces me to maintain a "local" WSDL file which I would prefer not but I didn't find any other way to do it.

And here is where I have my problem. Even if I put as "local" WSDL the exact content of the "automatic" WSDL that WebLogic provided me after deploying (the original without any of my changes!), the result is that in execution time my normal parameters (institution number, client number, etc) are correctly populated but my 3 header parameters (callerId, timestamps and signature) are NULL.

Please any suggestion ? what I am doing wrong ? Both functionalities works very nicely when not working together but the moment I put them together I am having this problem in execution. Why the binding is working fine in scenario 1 but not in scenario 2 ?

thanks
 
Felix Mercader
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the problem. Well, I tried something mad and it works. I put the 3 header parameters at the end, and then it works ! I find this very strange. Why can't I put them on the beginning ? Is it maybe a WebLogic problem ? Am I using old CXF classes with a bug ? Very strange but happy it is fixed now !

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!