我试图用java创建一个saop消息,我得到了一个错误
javax.xml.soap.soapexception:无法为soap创建消息工厂:无法创建saaj元工厂:找不到提供程序com.sun.xml.internal.messaging.saaj.soap.saajmetafactoryimpl
我的密码是
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?
1条答案
按热度按时间hi3rlvi21#
作为一个错误
com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl not found
需要为该类添加依赖项。在pom.xml中添加以下依赖项。