Announcement Announcement Module
No announcement yet.
Howto resolve namespaces when JAXB2 marshalling with bound classes? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Howto resolve namespaces when JAXB2 marshalling with bound classes?

    Hi all,

    I successfully managed to configure my very noddy web-service using the @Endpoint, @PayloadRoot and @XPathParam annotations. I wanted to go a step further and use JAXB2 marshalling and bound classes but after many hours or banging my head over this entire effort (it really feels like that) I'm about ready to settle with XPath.

    What I am stuck on is my SOAP body message does not get unmarshalled to my DTO-like class. Bare in mind that configured the XPath way all works fine.

    I have assumed using JAXB2 and bound classes (i.e. not contextPath) that some magic goes on and the XML is somehow mapped to the 'DTO'; am I being stupid and wishful here? lol

    It really seems to me that the namespace in my XML message is not getting picked up. When this happened some hours ago with the XPath strategy, the message was correctly routed but my XPaths fired blank. The '//tns:..' thing didn't work for me; how are you supposed to use the tns: prefix/namespace? To get around it I had to map the namespace in the Spring-WS config xml. Problem is I can't see how to do that with the marshalling strategy?

    Could it be to do with how the WSDL is built? I use the DefaultWsdl11Definition impl.

    Your help will be much appreciated, cheers

  • #2
    JAXB has a lot of dependencies. If you are absolutely bound then use it. I still have lot of CLASSPATH problems with JAXB 2.0 and JBOSS. When I run my application using a JUNIT test everything works well, but the same when using a Web project will throw me different marshalling/unmarshalling exception. I moved to JDOM instead of JAXB parsing.