When using wsimport the "standard" way:
wsimport.exe -d C:/temp/generatedClasses -s C:/temp/sourceFiles C:/temp/myWsdl.wsdl
I get source files generated like this:
@XmlRootElement(name = "PingRequest")
public class PingRequest{
Last time the classes were generated the same WSDL/ XSDs should have been used and generated a output like this:
@XmlRootElement(name = "PingRequest", namespace = "http://me.foo.bar/any/")
public class PingRequest {
So the schemas namespace was included as attribute of the annotation. Since the generated class package-info.java has the following entry:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://me.foo.bar/any", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
I assume adding the namespace-attribute is a done by configuration of wsimport/ jaxb schema compiler.
Could anyone explain me how to archive the namespace attribute beeing included?
Update: As Blaise answered correctly (described in the blog-link) the generated file package-info.java defines the namespace for all classes/ types inside the according package. Above example is obsolete if always the same namespace is included per @RootElement. Setting namespaces on @RootElement level may be used to have a certain @RootElement have its own namespace (which in case of wsimport should happen automaticially).
Very many thanks for any suggestions
What i tried:
- used google, found https://www.java.net/node/681149 (exaclty my question from back in 2008) with no answer :(
- read wsimport/ jaxb schema compiler options, tried out various that only controlled package ouput
- read 12 similar question/ answer that poped up when i typed in the title of this question
Closest i found that has something to do with the namespaces was to have 'elementFormDefault="qualified' specified in both the XSD itself and the import part inside the WSDL which i have done.