javajaxb

How do I instantiate a JAXBElement<String> object?


I need to create one of these as the interface requires it. Can someone please let me know how to create one, as there doesn't seem to be a constructor defined?


Solution

  • When you imported the WSDL, you should have an ObjectFactory class which should have bunch of methods for creating various input parameters.

    ObjectFactory factory = new ObjectFactory();
    JAXBElement<String> createMessageDescription = factory.createMessageDescription("description");
    message.setDescription(createMessageDescription);