use of no.difi.meldingsutveksling.noarkexchange.websak.PutMessageRequestMapper in project efm-integrasjonspunkt by felleslosninger.
the class WebsakPutMessageRequestMapperTest method mapFromEphortePutMessageToWebsakPutMessage.
@Test()
public void mapFromEphortePutMessageToWebsakPutMessage() throws JAXBException, XMLStreamException {
PutMessageRequestType putMessageRequestType = testData.loadFromClasspath("ephorte/PutMessageMessage.xml");
PutMessageRequestMapper mapper = new PutMessageRequestMapper();
no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType websakRequest = mapper.mapFrom(putMessageRequestType).getValue();
assertFalse(PayloadUtil.isEmpty(websakRequest.getPayload()));
JAXBContext ctx2 = JAXBContext.newInstance(PutMessageRequestType.class);
Marshaller marshaller = ctx2.createMarshaller();
StringWriter writer = new StringWriter();
marshaller.marshal(new ObjectFactory().createPutMessageRequest(putMessageRequestType), writer);
String xml = writer.toString();
JAXBContext ctx = JAXBContext.newInstance(no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType.class);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType websakResult = unmarshaller.unmarshal(new StringSource(xml), no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType.class).getValue();
System.out.println(websakResult.getPayload());
}
use of no.difi.meldingsutveksling.noarkexchange.websak.PutMessageRequestMapper in project efm-integrasjonspunkt by felleslosninger.
the class WebsakClient method sendEduMelding.
@Override
public PutMessageResponseType sendEduMelding(PutMessageRequestType request) {
JAXBElement<no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType> websakRequest = new PutMessageRequestMapper().mapFrom(request);
final WebServiceTemplate template = templateFactory.createTemplate("no.difi.meldingsutveksling.noarkexchange.websak.schema", markerFrom(new PutMessageRequestWrapper(request)));
JAXBElement<no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageResponseType> response = (JAXBElement) template.marshalSendAndReceive(settings.getEndpointUrl(), websakRequest, new SoapActionCallback(SOAP_ACTION));
PutMessageResponseType theResponse = new PutMessageResponseType();
ModelMapper modelMapper = new ModelMapper();
modelMapper.map(response.getValue(), theResponse);
setUnmappedValues(response, theResponse);
return theResponse;
}
use of no.difi.meldingsutveksling.noarkexchange.websak.PutMessageRequestMapper in project efm-integrasjonspunkt by felleslosninger.
the class WebsakPutMessageRequestMapperTest method emptyPayloadEphorteBug.
@Test
public void emptyPayloadEphorteBug() throws JAXBException, XMLStreamException {
PutMessageRequestType putMessageRequestType = testData.loadFromClasspath("ephorte/EmptyPayload.xml");
PutMessageRequestMapper mapper = new PutMessageRequestMapper();
final JAXBElement<no.difi.meldingsutveksling.noarkexchange.websak.schema.PutMessageRequestType> websakPutMessage = mapper.mapFrom(putMessageRequestType);
assertNotNull(websakPutMessage.getValue().getPayload());
}
Aggregations