Why do objects exported by JAX-WS require a default constructor?

JAX-WS requires that all passed classes have a default constructor (no-arg constructor). I do not understand this requirement because clients create their own classes based on WSDL. IMO this requirement makes sense only for those classes that are used as input parameters of the Webservice.

Does anyone know how to get around this requirement?

+5
source share
2 answers

When you use JAX-WS, you use the JAXB implementation to serialize your java objects to XML.

So the problem is how JAXB works.

JAXB, JAXBContext, , /. JAXB , no-arg. , .

JAXB ? no-arg XML (unmarshalling), , , JAXB , ( unmarshal)!

: JAXB , .

, JAX-WS?

@WebMethod, JAXB. - , -, no-arg.

: JAXB; -)

, , no-arg?

XMLAdapter! ...

+6

- , ?

- JAX-WS.

, ctor , ctor, - .

- : .

WSDL

, . WSDL, ?

0

All Articles