exception handling in SOAP webservices

hey guys. i have a question about SOAP webservice. i have this piece of code in my service layer:
Optional<Customer> customer=customerRepository.findById(Long.valueOf(perlasIdCheckRequestDTO.getUserId()));
if (customer.isEmpty()) {
log.info("PerlasService.checkId.NoCustomerException.CustomerId:{}.TransactionId:{}",perlasIdCheckRequestDTO.getUserId(),perlasIdCheckRequestDTO.getTransactionId());

throw new NoCustomerException("No customer with customerId:"+perlasIdCheckRequestDTO.getUserId());
}
Optional<Customer> customer=customerRepository.findById(Long.valueOf(perlasIdCheckRequestDTO.getUserId()));
if (customer.isEmpty()) {
log.info("PerlasService.checkId.NoCustomerException.CustomerId:{}.TransactionId:{}",perlasIdCheckRequestDTO.getUserId(),perlasIdCheckRequestDTO.getTransactionId());

throw new NoCustomerException("No customer with customerId:"+perlasIdCheckRequestDTO.getUserId());
}
and i have this exception:
@Getter
public class NoCustomerException extends RuntimeException {
public NoCustomerException(String message) {
super(message);
}
}
@Getter
public class NoCustomerException extends RuntimeException {
public NoCustomerException(String message) {
super(message);
}
}
and the exception is later handled by the RestResponseEntityExceptionHandler. so i have a couple of questions: 1. can i use the same exception? or do i need to create a duplicate one that will only be used for SOAP service? can i reuse the exception from my REST service? 2. how to handle the exceptions in SOAP webservices? i tried googling but honestly didnt understand a thing. can smb help me out? thx
1 Reply
JavaBot
JavaBot4mo ago
This post has been reserved for your question.
Hey @bambyzas! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server