My XSD is
<element name="GetCertificateByServiceName" >
<complexType>
<sequence>
<element ref="tns:ServiceName" />
</sequence>
</complexType>
</element>
<element name="ServiceName" type="string" />
Inspite of having S as capital the sub element is generated as "serviceName"
POJO Class:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"serviceName"
})
@XmlRootElement(name = "GetCertificateByServiceName")
public class GetCertificateByServiceName {
@XmlElement(name = "ServiceName", required = true)
protected String serviceName;
public String getServiceName() {
return serviceName;
}
public void setServiceName(String value) {
this.serviceName = value;
}
XML Generated
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header />
<S:Body>
<ns2:GetCertificateByServiceName xmlns:ns2="http://example.com/xsd/1.0">
<serviceName>ManagerService</serviceName>
</ns2:GetCertificateByServiceName>
</S:Body>
</S:Envelope>
Expected It should be ServiceName instead of serviceName and ns2 should be associated with ServiceName:
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header />
<S:Body>
<ns2:GetCertificateByServiceName xmlns:ns2="http://example.com/xsd/1.0">
<ns2:ServiceName>ManagerService</ns2:ServiceName>
</ns2:GetCertificateByServiceName>
</S:Body>
</S:Envelope>