'Single unexpected null value in a request while testing a rest controller with soapUI

I have a Controller which receives a request object via SoapUI (screen below). What confuses me it is that only one of the 2 attributes of this request object is null (it should not be), the other it is what it is meant to be.

This is my Controller:

@RestController
public class RestituzioneController {
    private static final Logger logger = LoggerFactory.getLogger(RestituzioneController.class);
    @Autowired
    RestService restService;
    
    @PostMapping(value="/restituzione")
    public RestituzioneResponse restituzione(@RequestBody RestituzioneRequest request) {
        logger.info("Start --------------- ");
        logger.info("request {}",request.toString());

and Request class being (I'm using Lombok):

@Data
public class RestituzioneRequest {
    private @NotEmpty String code;
    private @NotEmpty String numP;
}

After executing a POST call through SoapUI (screen below) this is what the log states:

Start ---------------
request RestituzioneRequest(code=null, numP=12XXX0000123)

SoapUI parameters: enter image description here



Solution 1:[1]

Did you try with other tools eg. Postman I'm pretty sure your code is perfectly fine, It might be conflict by SoapUI version issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 paranaaan