Has anyone used the axis APIs to generate XSD from Java? Something like java2XSD? Is anyone aware of another tool which can do it?
Axis certainly has the capability, but there appears to be no straightforward way to do it. Ideally I'd like a command line interface. Class: org.apache.axis.wsdl.fromJava.Types Constructor: org.apache.axis.wsdl.fromJava.Types(javax.wsdl.Definition def, TypeMapping tm, TypeMapping defaultTM, Namespaces namespaces, java.lang.String targetNamespace, java.util.List stopClasses) Class: org.apache.axis.encoding.Serializer.writeSchema(Types) Class: org.apache.axis.wsdl.fromJava.Emitter Snippet: Definition def; // The input wsdl types section is deleted. The // types will be added back in at the end of processing. def.setTypes(null); .. // Write out the interface def Document doc = WSDLFactory.newInstance(). newWSDLWriter().getDocument(intf); types.insertTypesFragment(doc); This is similar to what I want as a result. Namespaces have to be handled. <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:QRS"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <complexType name="Result"> <sequence> <element name="name" nillable="true" type="xsd:string"/> <element name="value" type="xsd:double"/> </sequence> </complexType> <complexType name="ArrayOfResult"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:Result[]"/> </restriction> </complexContent> </complexType> <element name="ArrayOfResult" nillable="true" type="impl:ArrayOfResult"/> </schema>