#how to use Jackson instead of JAXB to unmarshall XML to POJO when developing SOAP service?

4 messages · Page 1 of 1 (latest)

onyx merlin
#

hi guys. for some reason the default JAXB unmarshaller doesnt work in my SOAP service. i want to try use Jackson but the thing is that idk how to get the XML request body. can smb help me out? bc so far i have this, and it works, but i want to grab the XML from the request:

@Endpoint
public class PerlasEndpoint {
    @Autowired
    PerlasService perlasService;
    private static final String SOAP_NAMESPACE="http://mycompany.lt/soap-web-service";

    @PayloadRoot(namespace = SOAP_NAMESPACE,localPart = "idCheckRequest")
    @ResponsePayload
    public PerlasIdCheckResponseDTO checkId(@RequestPayload PerlasIdCheckRequestDTO perlasIdCheckRequestDTO) throws JAXBException, JsonProcessingException {
        String xml = "<idCheckRequest xmlns=\"http://mycompany.lt/soap-web-service\"><userId>51000</userId><transactionId>132</transactionId></idCheckRequest>";
        XmlMapper mapper = new XmlMapper();
        PerlasIdCheckRequestDTO value = mapper.readValue(xml, PerlasIdCheckRequestDTO.class);
        System.out.println("---: "+value.getUserId());

        PerlasIdCheckResponseDTO perlasIdCheckResponseDTO = new PerlasIdCheckResponseDTO();
        perlasIdCheckResponseDTO.setStatus("STATUS");
        return perlasIdCheckResponseDTO;
    }
}
opaque carbonBOT
#

This post has been reserved for your question.

Hey @onyx merlin! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

onyx merlin
#

any help?