Announcement Announcement Module
Collapse
No announcement yet.
No @XmlRootElement.. Questions about binding.xml Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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:
    http://forums.java.net/jive/message....ssageID=350060
    http://weblogs.java.net/blog/kohsuke...es_jaxb_p.html

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

    Thanks
    G

  • #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:
    Code:
    QName qName = new Name("urn:messages_2009_2.platform.webservices.netsuite.com", "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, 10:04 AM. Reason: lets spell note correctly this time

    Comment

    Working...
    X