java variables need to have the same name like in SOAP request?

hi guys. i have soap service in java spring. i have this dto class:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
        "userid",
        "trans_id"
})
@XmlRootElement(name = "idCheckRequest", namespace = "http://mycompany.lt/soap-web-service")
@Data
public class PerlasCheckIdRequestDTO {
    @NotNull(message = "userId cant be null")
    @Size(max = 32, message = "userId too long")
    @XmlElement(name = "userid", required = true, namespace = "http://mycompany.lt/soap-web-service" )
    private String userId;

    @NotNull(message = "transactionId cant be null")
    @Size(max = 100, message = "transactionId too long")
    @XmlElement(name = "trans_id", required = true, namespace = "http://mycompany.lt/soap-web-service")
    private String transactionId;
}

i send this request body:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:idcheck>
         <soap:trans_id>903</soap:trans_id>
         <soap:userid>903</soap:userid>
      </soap:idcheck>
   </soapenv:Body>
</soapenv:Envelope>

but i get:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode>SOAP-ENV:Server</faultcode>
            <faultstring xml:lang="en">4 counts of IllegalAnnotationExceptions</faultstring>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

i noticed that if i name my java vars the same like they are named in request xml, everything is fine. But the thing is that my code gets messy. Is there a fix for this scenario?
Was this page helpful?