How do I configure namespace prefixes in autogenerated WSDL in Metro / JavaEE?

I am using Java 6 + JavaEE + Tomcat 6 + Metro for SOAP web services. In the response, namespace prefixes are ns2, ns3, ns4, etc. I would like to be able to instruct the web services stack instead of using custom names.

How to do it?

0


source to share


1 answer


Use @XmlSchema annotation (assuming you are using JAXB2.x)

@XmlSchema (
  xmlns = { 
    @XmlNs(prefix = "so", 
               namespaceURI="http://stackoverflow.com/questions/358991")
  )
)

      



Result:

<schema
    xmlns:so="http://stackoverflow.com/questions/358991"
    targetNamespace="http://stackoverflow.com/questions/358991">

      

+1


source







All Articles