Reputation: 997
I would like to use Spring WS to build a Webservice-Client with JAXB for marshalling and unmarshalling the Java classes.
But what I have is just one WSDL file. When I understand it right, I can generate Java classes with JAXB (xjc.exe), which then can be used by me with Spring WS to retrieve the Webservice-Data and send an answer.
But JAXB can only generate Java classes from xsd-schema files. Must I now manually copy those xsd-definitions from within the WSDL file to generate those classes via JAXB? (in my case the WSDL file contains 4 XSD definitions).
Or is there a way to just convert the whole WSDL to Java classes which I can use with Spring WS (I know there is the "wsimport", but it is part of JAX-WS and I think I can't use it in this scenario, right?).
So what is the common approach with Spring WS / JAXB / one WSDL file?
I really would like to get startet with Spring WS and JAXB - thanks a lot for your help!
Upvotes: 5
Views: 12791
Reputation: 403591
I can generate Java classes with JAXB (xbj.exe)
xjc
, you mean.
Must I now manually copy those xsd-definitions from within the WSDL file to generate those classes via JAXB?
That's one option, certainly. A more automated approach is to write an XSL transform to extract the schema components into temporary files, and then to run XJC over those. A bit more work, but automation is always good.
I know there is the "wsimport", but it is part of JAX-WS and I think I can't use it in this scenario, right?
Actually, JAX-WS artifacts are just a decorated form of JAXB. wsimport
will produce some JAX-WS-specific stuff, plus the standard JAXB artifacts representing the schema components. You should be able to use the JAXB generated classes for Spring-WS, and ignore the JAX-WS-specific ones.
Upvotes: 3