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 Multiple Jars Issue: SoapHeader.addHeaderElement(Name) Vs SoapHeader.addHeaderElement(Name) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Multiple Jars Issue: SoapHeader.addHeaderElement(Name) Vs SoapHeader.addHeaderElement(Name) " Watch "Multiple Jars Issue: SoapHeader.addHeaderElement(Name) Vs SoapHeader.addHeaderElement(Name) " New topic
Author

Multiple Jars Issue: SoapHeader.addHeaderElement(Name) Vs SoapHeader.addHeaderElement(Name)

Samuel Jason
Greenhorn

Joined: Jun 26, 2011
Posts: 10
HI,

I am working on a spring-ws client to invoke a webservice using binary security token. I have all the code set-up and everything seems to be working fine except for one issue.

This spring-ws client will be deployed as part of an EAR on weblogic server. There are several third part jar files in the classpath including axis jars.

Now following line is my code is causing troubles :

where ctxElement is of type JAXBElement and header is of type javax.xml.soap.SOAPHeader;

Error: addHeaderElement(javax.xml.soap.Name) in javax.xml.soap.SOAPHeader cannot be applied to (javax.xml.namespace.QName)

I did some analysis and figured out the issue - javax.xml.soap.SOAPHeader class is available in both axis/saaj.jar and spring/jaxb-api2.1jar.
The version present in axis/saaj.jar only has following method
javax.xml.soap.SOAPHeader.addHeaderElement(Name)

The version present in spring/jaxb-api2.1jar only has both the following methods
javax.xml.soap.SOAPHeader.addHeaderElement(Name)
javax.xml.soap.SOAPHeader.addHeaderElement(QName)

Now do I solve this issue -

Should I just make sure spring/jaxb-api2.1jar appears before axis/saaj.jar in the classpath. Is that the correct way to address this issue in a production environment.
What are the alternate solutions?

Please help

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Jars Issue: SoapHeader.addHeaderElement(Name) Vs SoapHeader.addHeaderElement(Name)
 
Similar Threads
Exception occuring while accessing web services
running ant from within a .bat file
can't generate java from wsdl file please help!
loader constraint violation
Raising an Exception from a JAXB Web Service