This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SOAP Header Code  RSS feed

 
Jeff Margileth
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm developing a SOAP client and have used wsimport to generate the classes, etc. and all is going pretty well, but the server requires several headers that I've been coding up manually, specifically wise:Security and o:Security blocks. While this is a valid approach, I think I'm probably doing things the hard way and I know .NET (SOAP being an MS standard originally) has some really powerful code to generate these headers. Does java have any similar counterparts? Or does everyone hand code it? As an example, I'm writing code like the following:



To generate XML like:



I'm currently fighting a specific signature problem (see Other Forum Post) but there's got to be a better way in general to do all this.

I appreciate the help.

Jeff
 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please clarify below:

(1) Are you using any web services frameworks like Axis or CXF?
(2) Is the client application you are coding is stand-alone or web application?
 
Jeff Margileth
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vijay,

It is a web app and the SOAP client code was generated with wsimport. Do you know of any libraries for signing or generating types of headers that comply to SOAP standards? Hand coding works, but seems like a poor approach.

Jeff
 
Vijay Chandran
Ranch Hand
Posts: 186
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeff,

If you use CXF framework there is a concept called "Interceptor" which will intercept the outgoing request from the client code and add the security headers for you. You need to write a password callback class and configure it in the WSS4J interceptor of CXF. That's it.. the framework will take care of adding the security headers for you.
Similar options should be available in Axis2 as well


Please refer:
CXF WS-Security

Simple jaxws-client authentication:
JAXWS-Client-Auth


Regards,
Vijay
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!