javaweb-servicessoapwsdlxsd2code

Custom element type in XSD


For SOAP webservice i have a response bean as

@XmlRootElement(name = "AddResponse")
public class AddResponse {  
    Integer addResult;
    /**
     * @return the addResult
     */
    @XmlElement(name = "AddResult")
    public Integer getAddResult() {
        return addResult;
    /**
     * @param addResult the addResult to set
     */
    public void setAddResult(Integer addResult) {
        this.addResult = addResult;
    }
}

which generates xsd as below

<xs:schema xmlns:tns="http://controller.ws.sella.it/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://controller.ws.sella.it/">
<xs:element name="AddRequest" type="tns:addRequest"/>
<xs:element name="AddResponse" type="tns:addResponse"/>

is there a way to have a custom element type like

<xs:element name="AddResponse" type="tns:AddResponseType"/>

Is it possible?


Solution

  • i was able to set the custom element type name using

    @XmlType(name= "AddRequestType")
    

    Ref