no.difi.meldingsutveksling.ks.svarut.SvarUtWebServiceClientImpl Maven / Gradle / Ivy
package no.difi.meldingsutveksling.ks.svarut;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import javax.xml.bind.JAXBElement;
import java.util.List;
import java.util.Set;
@Slf4j
public class SvarUtWebServiceClientImpl extends WebServiceGatewaySupport implements SvarUtWebServiceClient {
@Override
public String sendMessage(SvarUtRequest request) {
final JAXBElement response = (JAXBElement) getWebServiceTemplate().marshalSendAndReceive(request.getEndPointURL(), request.getForsendelse());
return response.getValue().getReturn();
}
@Override
public String getForsendelseId(String uri, String eksternRef) {
log.debug("No local forsendelseId mapping for messageId={}, performing lookup..", eksternRef);
RetrieveForsendelseIdByEksternRef request = RetrieveForsendelseIdByEksternRef.builder().
withEksternRef(eksternRef).build();
ObjectFactory objectFactory = new ObjectFactory();
final JAXBElement response =
(JAXBElement)
getWebServiceTemplate().marshalSendAndReceive(uri,
objectFactory.createRetrieveForsendelseIdByEksternRef(request));
List responseReturn = response.getValue().getReturn();
if (responseReturn == null || responseReturn.isEmpty()) {
return null;
} else {
return responseReturn.get(0);
}
}
@Override
public ForsendelseStatus getForsendelseStatus(String uri, String forsendelseId) {
RetrieveForsendelseStatus request = RetrieveForsendelseStatus.builder().withForsendelsesid(forsendelseId).build();
final JAXBElement response =
(JAXBElement)
getWebServiceTemplate().marshalSendAndReceive(uri, request);
return response.getValue().getReturn();
}
public List getForsendelseStatuser(String uri, Set forsendelseIds) {
RetrieveForsendelseStatuser request = RetrieveForsendelseStatuser.builder().withForsendelseider(forsendelseIds).build();
final JAXBElement response =
(JAXBElement)
getWebServiceTemplate().marshalSendAndReceive(uri, request);
return response.getValue().getReturn();
}
public List retreiveForsendelseTyper(String uri) {
RetreiveForsendelseTyper request = RetreiveForsendelseTyper.builder().build();
JAXBElement wrapped = new ObjectFactory().createRetreiveForsendelseTyper(request);
final JAXBElement response =
(JAXBElement) getWebServiceTemplate().marshalSendAndReceive(uri, wrapped);
return response.getValue().getReturn();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy