Announcement Announcement Module
No announcement yet.
No @XmlRootElement.. Questions about binding.xml Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • No @XmlRootElement.. Questions about binding.xml

    God morning.
    I am trying to build a client (using sping-ws) that consumes a third party web-service. It seems that the wsdl/schema is written in such a way that elements that I would expect to be root elements, such as ~Request and ~Response arent.

    I have done a bit of digging and it seems I can use the binding.xml file to override what jaxb is doing:

    My question is it possible to target the simple binding to just *Request and *Response?


  • #2
    Ok, I went down the code route. This will make the code a little ugly, but I think will give me more confidence.

    The solution is:
    QName qName = new Name("", "LoginRequest", "pp");
    JAXBElement<LoginRequest> jaxbLoginRequest = new JAXBElement<LoginRequest>(qName, LoginRequest.class, loginRequest);
    marshaller.marshal(jaxbLoginRequest, new StreamResult(os));
    Please note that I had to give the QName a prefix or it wouldnt marshal the object to xml correctly. This could be a quirk of my objects and how they were construct from the wsdl.
    Last edited by Encrypt; Aug 20th, 2010, 09:04 AM. Reason: lets spell note correctly this time