diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java
index 40fafe60d01319d3c47cfc2d98d41380b75df2c4..1ffceef42929acde004e4714f735a533b2ef82e7 100644
--- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java
+++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ui/UIDomainService.java
@@ -144,14 +144,14 @@ public class UIDomainService extends UIServiceBase<DBDomain, DomainRO> {
             throw new BadRequestException(ErrorBusinessCode.NOT_FOUND, msg);
         }
 
-        Optional<DBDomain> domainBySmlSmpId = domainDao.getDomainBySmlSmpId(data.getSmlSmpId());
+        Optional<DBDomain> domainBySmlSmpId = domainDao.getDomainBySmlSmpId(StringUtils.trim(data.getSmlSmpId()));
         if (domainBySmlSmpId.isPresent() && !Objects.equals(domainBySmlSmpId.get().getId(), domain.getId())) {
             String msg = "SMP-SML identifier must unique. The SmlSmpId [" + data.getSmlSmpId() + "] is already used by other domains!";
             throw new BadRequestException(ErrorBusinessCode.NOT_FOUND, msg);
         }
 
         domain.setSmlSubdomain(data.getSmlSubdomain());
-        domain.setSmlSmpId(data.getSmlSmpId());
+        domain.setSmlSmpId(StringUtils.trim(data.getSmlSmpId()));
         domain.setSmlClientKeyAlias(data.getSmlClientKeyAlias());
         domain.setSmlClientCertAuth(data.isSmlClientCertAuth());
     }