The Qlik Talend tESBConsumer component fails to call a web service with the error:
Unable to create message factory for SOAP: Error while searching for service
This may occur after recently upgrading Qlik Talend and moving from JDK 11 to JDK 17. Post upgrade, the following error is encountered when calling a web service using tESBConsumer:
##Log## tESBConsumer:Failed webservice call- Problem writing SAAJ model to stream [WARN ] 13:14:53 org.apache.cxf.phase.PhaseInterceptorChain- Interceptor for {http://xmlns.oracle.com/Enterprise/Tools/services}PROCESSREQUEST#{http://xmlns.oracle.com/Enterprise... has thrown exception, unwinding now org.apache.cxf.binding.soap.SoapFault: Problem writing SAAJ model to stream: Unable to create message factory for SOAP: Error while searching for service [jakarta.xml.soap.MessageFactory] Caused by: jakarta.xml.soap.SOAPException: Unable to create message factory for SOAP: Error while searching for service [jakarta.xml.soap.MessageFactory] at jakarta.xml.soap.MessageFactory.newInstance(MessageFactory.java:96) ~[jakarta.xml.soap-api-3.0.2.jar:3.0.2] at org.apache.cxf.binding.soap.saaj.SAAJFactoryResolver.createMessageFactory(SAAJFactoryResolver.java:57) ~[cxf-rt-bindings-soap-4.1.0.jar:4.1.0] at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.getFactory(SAAJOutInterceptor.java:86) ~[cxf-rt-bindings-soap-4.1.0.jar:4.1.0] at org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.handleMessage(SAAJOutInterceptor.java:122) ~[cxf-rt-bindings-soap-4.1.0.jar:4.1.0] ... 16 more
Resolution
To resolve this, the necessary SAAJ implementation and its dependencies must be explicitly provided as separate libraries in the application's classpath. This typically involves including the following:
Jakarta SOAP API: This provides the API interfaces for SAAJ.
The dependencies, which can be added to the Studio job by utilizing tLibraryLoad components to load the compatible saaj-impl jar:
The jakarta.xml.soap.SOAPException 'Unable to create message factory for SOAP error', specifically mentions an error while searching for the service [jakarta.xml.soap.MessageFactory]. This indicates a problem with the availability or configuration of the SAAJ (SOAP with Attachments API for Java) implementation.
This issue commonly arises in environments using Java 11 or later, as JAX-WS and its related technologies, such as SAAJ, were removed from the standard Java Development Kit (JDK) in these versions.