У меня есть конечная точка, которая проверяет, существует ли идентификатор в базе данных, и возвращает статус.USSD API, который будет вызывать эту конечную точку. Когда я делаю запрос с несуществующим идентификатором (EcNumber), ответ возвращает сообщение, как я ожидаю. Однако, когда я передаю идентификатор, который находится в базе данных, я также получаю тот же статуссообщение. Мне нужна помощь в использовании любого из isEmpty () / null для достижения того же:
ClientEndpoint.java
@Endpoint
public class ClientEndpoint {
private static final String NAMESPACE_URI = "http://www.onewallet.org/webservices/disburse";
@Autowired
private IClientService clientService;
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getClientByEcNumRequest")
@ResponsePayload
public GetClienttByEcNumResponse getClient(@RequestPayload GetClientByEcNumRequest request) {
GetClienttByEcNumResponse response = new GetClienttByEcNumResponse();
ServiceStatus serviceStatus = new ServiceStatus();
ClientInfo clientInfo = new ClientInfo();
if ( clientInfo==null || clientInfo.getEcNumber()==null ){
serviceStatus.setMessage("EC# not registered with MCP");
} else {
BeanUtils.copyProperties(clientService.getClientByEcNumber(request.getEcNumber() ), clientInfo);
serviceStatus.setMessage("Welcome to MCP MobileLoans");
}
response.setServiceStatus(serviceStatus);
return response;
Когда я передаю запрос ниже для действительного EcNumber:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dis="http://www.onewallet.org/webservices/disburse">
<soapenv:Header/>
<soapenv:Body>
<dis:getClientByEcNumRequest>
<dis:ecNumber>5501900T</dis:ecNumber>
</dis:getClientByEcNumRequest>
</soapenv:Body>
</soapenv:Envelope>
я получаю ответ:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns2:getClienttByEcNumResponse xmlns:ns2="http://www.onewallet.org/webservices/disburse">
<ns2:serviceStatus>
<ns2:message>EC# not registered with MCP</ns2:message>
</ns2:serviceStatus>
</ns2:getClienttByEcNumResponse>