开发者

JAXB cannot marshall and unmarshall Opensaml and Openws objects with non-arg constructors?

开发者 https://www.devze.com 2023-01-28 01:49 出处:网络
I am currently building my own custom Security Token Services using the Opensaml and Openws APIs. I am using CXF with Spring, this technology facilitates interceptors that allow me to manipulate and

I am currently building my own custom Security Token Services using the Opensaml and Openws APIs.

I am using CXF with Spring, this technology facilitates interceptors that allow me to manipulate and insert elements (SAML Assertions etc) into the soap header.

However, I would like to insert an OpenWS RequestSecurityToken object into the soap body, via my web service method.

The OpenWS RequestSecurityToken object itself does no have a non-argument constructor defined, and neither does it's superclasses. Root class being org.w3c.xml.Element which also does not have an empty constructor.

JAXB 开发者_如何学编程throws an exception, complaining about this, saying it can't handle interfaces - even though these classes are not interfaces!

I do not have the source code and so am not able to add constructors easily. Much has been posted on the internet about this, with pointers to custom annotations, adapter classes and custom marshallers, but I cannot work out which approach to adopt.

BTW: OpenWS and Opensaml does come with Marshallers and Unmarshallers for each object. I was wondering if anyone has managed to force JAXB to use custom marshallers at all?


You can use an XmlAdapter, check out:

  • http://bdoughan.blogspot.com/2010/12/jaxb-and-immutable-objects.html
  • http://bdoughan.blogspot.com/2010/07/xmladapter-jaxbs-secret-weapon.html
0

精彩评论

暂无评论...
验证码 换一张
取 消