Search in sources :

Example 1 with PutMessageResponseType

use of no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType in project efm-integrasjonspunkt by felleslosninger.

the class EphorteClientTest method testSendEduMelding.

@Test
public void testSendEduMelding() throws Exception {
    NoarkClientSettings settings = new NoarkClientSettings("http://localhost:7778/ephorte", "", "");
    EphorteClient client = new EphorteClient(settings);
    PutMessageResponseType result = client.sendEduMelding(new PutMessageRequestType());
    assertEquals("Hello world", result.getResult().getType());
}
Also used : PutMessageResponseType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType) PutMessageRequestType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageRequestType) Test(org.junit.jupiter.api.Test)

Example 2 with PutMessageResponseType

use of no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType in project efm-integrasjonspunkt by felleslosninger.

the class P360Client method sendEduMelding.

@Override
public PutMessageResponseType sendEduMelding(PutMessageRequestType request) {
    JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageRequestType> p360request = new PutMessageRequestMapper().mapFrom(request);
    final WebServiceTemplate template = templateFactory.createTemplate("no.difi.meldingsutveksling.noarkexchange.p360.schema", PutMessageMarker.markerFrom(new PutMessageRequestWrapper(request)));
    JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageResponseType> response = (JAXBElement<no.difi.meldingsutveksling.noarkexchange.p360.schema.PutMessageResponseType>) template.marshalSendAndReceive(settings.getEndpointUrl(), p360request, new SoapActionCallback(SOAP_ACTION));
    PutMessageResponseType theResponse = new PutMessageResponseType();
    ModelMapper modelMapper = new ModelMapper();
    modelMapper.map(response.getValue(), theResponse);
    setUnmappedValues(response, theResponse);
    if (!isValid(theResponse)) {
        theResponse = new PutMessageResponseType();
        final no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType appReceiptType = new no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType();
        theResponse.setResult(appReceiptType);
        appReceiptType.setType("OK");
    }
    return theResponse;
}
Also used : no.difi.meldingsutveksling.noarkexchange.p360.schema(no.difi.meldingsutveksling.noarkexchange.p360.schema) PutMessageResponseType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType) JAXBElement(javax.xml.bind.JAXBElement) PutMessageRequestMapper(no.difi.meldingsutveksling.noarkexchange.p360.PutMessageRequestMapper) WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) ModelMapper(org.modelmapper.ModelMapper) PutMessageRequestType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageRequestType) SoapActionCallback(org.springframework.ws.soap.client.core.SoapActionCallback)

Example 3 with PutMessageResponseType

use of no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType in project efm-integrasjonspunkt by felleslosninger.

the class PutMessageResponseFactory method createErrorResponse.

public static PutMessageResponseType createErrorResponse(String errorMsg) {
    PutMessageResponseType response = new PutMessageResponseType();
    AppReceiptType receipt = new AppReceiptType();
    receipt.setType("ERROR");
    StatusMessageType statusMessageType = new StatusMessageType();
    statusMessageType.setText(errorMsg);
    statusMessageType.setCode("Unknown");
    receipt.getMessage().add(statusMessageType);
    response.setResult(receipt);
    return response;
}
Also used : PutMessageResponseType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType) StatusMessageType(no.difi.meldingsutveksling.noarkexchange.schema.StatusMessageType) AppReceiptType(no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType)

Example 4 with PutMessageResponseType

use of no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType 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;
}
Also used : PutMessageResponseType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType) JAXBElement(javax.xml.bind.JAXBElement) PutMessageRequestMapper(no.difi.meldingsutveksling.noarkexchange.websak.PutMessageRequestMapper) WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) ModelMapper(org.modelmapper.ModelMapper) PutMessageRequestType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageRequestType) SoapActionCallback(org.springframework.ws.soap.client.core.SoapActionCallback)

Example 5 with PutMessageResponseType

use of no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType in project efm-integrasjonspunkt by felleslosninger.

the class EphorteClient method sendEduMelding.

@Override
public PutMessageResponseType sendEduMelding(PutMessageRequestType request) {
    ModelMapper modelMapper = new ModelMapper();
    no.difi.meldingsutveksling.noarkexchange.ephorte.schema.PutMessageRequestType r = new no.difi.meldingsutveksling.noarkexchange.ephorte.schema.PutMessageRequestType();
    modelMapper.map(request, r);
    JAXBElement<no.difi.meldingsutveksling.noarkexchange.ephorte.schema.PutMessageRequestType> ephorteRequest;
    try {
        ephorteRequest = new PutMessageRequestMapper().mapFrom(request);
    } catch (JAXBException e) {
        throw new RuntimeException("Failed to map request from internal PutMessageRequest to ephorte", e);
    }
    final WebServiceTemplate template = templateFactory.createTemplate("no.difi.meldingsutveksling.noarkexchange.ephorte.schema", markerFrom(new PutMessageRequestWrapper(request)));
    JAXBElement<no.difi.meldingsutveksling.noarkexchange.ephorte.schema.PutMessageResponseType> ephorteResponse = (JAXBElement<no.difi.meldingsutveksling.noarkexchange.ephorte.schema.PutMessageResponseType>) template.marshalSendAndReceive(settings.getEndpointUrl(), ephorteRequest);
    PutMessageResponseType response = new PutMessageResponseType();
    modelMapper.map(ephorteResponse.getValue(), response);
    setUnmappedValues(ephorteResponse, response);
    return response;
}
Also used : no.difi.meldingsutveksling.noarkexchange.ephorte.schema(no.difi.meldingsutveksling.noarkexchange.ephorte.schema) PutMessageResponseType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType) JAXBException(javax.xml.bind.JAXBException) JAXBElement(javax.xml.bind.JAXBElement) PutMessageRequestMapper(no.difi.meldingsutveksling.noarkexchange.ephorte.PutMessageRequestMapper) WebServiceTemplate(org.springframework.ws.client.core.WebServiceTemplate) ModelMapper(org.modelmapper.ModelMapper) PutMessageRequestType(no.difi.meldingsutveksling.noarkexchange.schema.PutMessageRequestType)

Aggregations

PutMessageResponseType (no.difi.meldingsutveksling.noarkexchange.schema.PutMessageResponseType)9 PutMessageRequestType (no.difi.meldingsutveksling.noarkexchange.schema.PutMessageRequestType)5 AppReceiptType (no.difi.meldingsutveksling.noarkexchange.schema.AppReceiptType)4 JAXBElement (javax.xml.bind.JAXBElement)3 ModelMapper (org.modelmapper.ModelMapper)3 WebServiceTemplate (org.springframework.ws.client.core.WebServiceTemplate)3 StatusMessageType (no.difi.meldingsutveksling.noarkexchange.schema.StatusMessageType)2 SoapActionCallback (org.springframework.ws.soap.client.core.SoapActionCallback)2 IOException (java.io.IOException)1 OffsetDateTime (java.time.OffsetDateTime)1 JAXBException (javax.xml.bind.JAXBException)1 MessageInformable (no.difi.meldingsutveksling.MessageInformable)1 ServiceIdentifier (no.difi.meldingsutveksling.ServiceIdentifier)1 Organisasjonsnummer (no.difi.meldingsutveksling.domain.Organisasjonsnummer)1 SvarInnPutMessageBuilder (no.difi.meldingsutveksling.ks.svarinn.SvarInnPutMessageBuilder)1 MailClient (no.difi.meldingsutveksling.mail.MailClient)1 ConversationDirection (no.difi.meldingsutveksling.nextmove.ConversationDirection)1 PutMessageRequestMapper (no.difi.meldingsutveksling.noarkexchange.ephorte.PutMessageRequestMapper)1 no.difi.meldingsutveksling.noarkexchange.ephorte.schema (no.difi.meldingsutveksling.noarkexchange.ephorte.schema)1 PutMessageRequestMapper (no.difi.meldingsutveksling.noarkexchange.p360.PutMessageRequestMapper)1