com.sun.xml.messaging.saaj.soap.MessageFactoryImpl not found
843834Jan 23 2003 — edited Jun 29 2010I comoiled the following codes. It passed but could not be run.
import javax.xml.soap.*;
import java.io.*;
import javax.xml.transform.stream.*;
import javax.xml.messaging.*;
public class AsinSOAP{
public static void main(String args[]){
try {
javax.xml.soap.MessageFactory factory = javax.xml.soap.MessageFactory.newInstance();
SOAPMessage request = factory.createMessage();
SOAPPart soapPart = request.getSOAPPart();
StreamSource src = new StreamSource(new FileInputStream(args[0]));
soapPart.setContent(src);
SOAPConnectionFactory conFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = conFactory.createConnection();
URLEndpoint endpoint = new URLEndpoint(args[1]);
System.out.println("AsinSearchQuery:");
request.writeTo(System.out);
SOAPMessage response = connection.call(request,endpoint);
System.out.println("AsinSearchResult");
response.writeTo(System.out);
} catch (SOAPException e) {
System.err.println(e.getMessage());
} catch (IOException e){
System.err.println(e.getMessage());
}
}
}
The error was
Unable to create message factory for SOAP: Provider com.sun.xml.messaging.saaj.soap.MessageFactoryImpl not found
I didn't use that class on my program. Why do we need it?