Jagannath Jha
Jagannath Jha

Reputation: 1

With Open Jdk 19 , Cannot find SOAP wrapper for element [soap:Fault: null]

We are consumng soap service and it was worlking very well when we were using Java 8 and Spring boot 2.X When we are migrating to open Jdk 19 and Spring Boot 3.x which uses Jakarta It has exception when soap fault.

Not able to parse soap fault and some where seen in debug not able to type cast in jakarta.xml.node

Cannot find SOAP wrapper for element [soap:Fault: null]

Here is is our client code

final Marshaller marshaller = webServiceTemplateParam.getMarshaller();

Object ret = webServiceTemplateParam.sendAndReceive(request - > {
    if (requestPayload != null) {

        if (marshaller == null) {
            throw new IllegalStateException("No marshaller registered. Check configuration of WebServiceTemplate.");
        }
        MarshallingUtils.marshal(marshaller, requestPayload, request);

        Assert.isInstanceOf(SoapMessage.class, request);
        SoapMessage soapMessage = (SoapMessage) request;
        soapMessage.setSoapAction(soapAction);

    }
}, new WebServiceMessageExtractor < Object > () {

    @Override
    public Object extractData(final WebServiceMessage response) throws IOException {
        if (unmarshaller == null) {
            throw new IllegalStateException("No unmarshaller registered. Check configuration of WebServiceTemplate.");
        }
        if (hasFault(response)) {
            throw new SoapFaultClientException((SoapMessage) response);
        } else {
            return MarshallingUtils.unmarshal(unmarshaller, response);
        }
    }

    boolean hasFault(final WebServiceMessage response) {
        if (response instanceof FaultAwareWebServiceMessage) {
            FaultAwareWebServiceMessage faultMessage = (FaultAwareWebServiceMessage) response;
            return faultMessage.hasFault();
        }
        return false;
    }
});

Upvotes: 0

Views: 333

Answers (0)

Related Questions