diff --git a/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/service/IdentService.java b/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/service/IdentService.java index 460e6f249f9..093c24da889 100644 --- a/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/service/IdentService.java +++ b/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/service/IdentService.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBException; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -17,6 +18,7 @@ import no.nav.tps.ctg.m201.domain.TpsServiceRutineType; import org.springframework.stereotype.Service; +import javax.xml.namespace.QName; import java.io.StringWriter; import java.util.HashMap; import java.util.List; @@ -50,17 +52,6 @@ public IdentService(ServicerutineConsumer servicerutineConsumer, this.objectMapper = objectMapper; } - @SneakyThrows - public static String marshallToXML(JAXBContext requestContext, TpsPersonData endringsmelding) { - - var marshaller = requestContext.createMarshaller(); - - var writer = new StringWriter(); - marshaller.marshal(endringsmelding, writer); - - return writer.toString(); - } - public List getIdenter(List identer, List miljoer, Boolean includeProd) { if (identer.size() > MAX_LIMIT) { @@ -89,6 +80,18 @@ public List getIdenter(List identer, List mil .toList(); } + @SneakyThrows + public static String marshallToXML(JAXBContext requestContext, TpsPersonData endringsmelding) { + + var marshaller = requestContext.createMarshaller(); + + var writer = new StringWriter(); + JAXBElement element = new JAXBElement<>(new QName("", "tpsPersonData"), TpsPersonData.class, endringsmelding); + marshaller.marshal(element, writer); + + return writer.toString(); + } + private boolean exists(String ident, TpsServicerutineM201Response response) { return nonNull(response.getTpsSvar()) && diff --git a/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/service/SpraakService.java b/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/service/SpraakService.java index b53f2dd627d..60054cfe769 100644 --- a/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/service/SpraakService.java +++ b/apps/tps-messaging-service/src/main/java/no/nav/testnav/apps/tpsmessagingservice/service/SpraakService.java @@ -1,5 +1,7 @@ package no.nav.testnav.apps.tpsmessagingservice.service; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; import lombok.extern.slf4j.Slf4j; import ma.glasnost.orika.MapperFacade; import ma.glasnost.orika.MappingContext; @@ -12,8 +14,6 @@ import no.nav.testnav.libs.data.tpsmessagingservice.v1.SpraakDTO; import org.springframework.stereotype.Service; -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; import java.util.List; import java.util.Map; import java.util.stream.Collectors;