I am trying to create a saop message in java and i am getting the error
javax.xml.soap.SOAPException: Unable to create message factory for SOAP: Unable to create SAAJ meta-factory: Provider com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
My code is this
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
createSoapEnvelope(soapMessage);
MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", soapAction);
soapMessage.saveChanges();
/* Print the request message, just for debugging purposes */
System.out.println("Request SOAP Message:");
soapMessage.writeTo(System.out);
System.out.println("\n");
return soapMessage;
}```
I am using jdk14, what could be the solution?
As error clearly suggesting
com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not foundneed to add dependency for that class.Add below dependency in your pom.xml.