我正在尝试使用Java中的soap Web服务,它只能与eclipse IDE一起使用,但在导入JBPM项目时不起作用。我得到的错误是:
无法确定BusFactory实现类名称:java.lang.ClassCastException:class org.apache.cxf.bus.spring.SpringBusFactory
它与Eclipse完美配合
import java.io.*;
import java.util.Iterator;
import javax.xml.soap.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.*;
import org.xml.sax.InputSource;
public class metodos {
public metodos() {
super();
}
public String getInfo() {
String retorno = "";
System.out.println("methodGetInfo ");
try {
System.out.println("methodGetInfo newInstance");
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
System.out.println("methodGetInfo createConnection");
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
System.out.println("methodGetInfo MessageFactory newInstance");
MessageFactory messageFactory = MessageFactory.newInstance();
System.out.println("methodGetInfo createMessage");
javax.xml.soap.SOAPMessage soapRequest = messageFactory.createMessage();
System.out.println("methodGetInfo getSOAPPart");
SOAPPart soapPart = soapRequest.getSOAPPart();
System.out.println("methodGetInfo getEnvelope");
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
soapEnvelope.addNamespaceDeclaration("end", endPoint);
SOAPBody soapBody = soapEnvelope.getBody();
soapBody.addChildElement("getInfo", "end");
soapRequest.saveChanges();
System.out.println("methodGetInfo soapConnection call");
SOAPMessage soapResponse = soapConnection.call(soapRequest, url);
System.out.println("methodGetInfo transformerFactory");
TransformerFactory transformerFactory = TransformerFactory.newInstance();
System.out.println("methodGetInfo newTransformer");
Transformer transformer = transformerFactory.newTransformer();
System.out.println("methodGetInfo getSOAPPart");
Source sourceContent = soapResponse.getSOAPPart().getContent();
System.out.println("methodGetInfo StringWriter");
StringWriter writer = new StringWriter();
System.out.println("methodGetInfo StreamResult");
StreamResult result = new StreamResult(writer);
System.out.println("methodGetInfo transformer.transform");
transformer.transform(sourceContent, result);
当我使用JBPM时,我收到此错误:
该错误是由此行引起的:
SOAPMessage soapResponse = soapConnection.call(soapRequest,url);
我没有在java中使用任何外部库。
Java编译器级别:1.8
JBPM版本:7.17.0 Final
似乎有两个不同版本的apache cxf可用,一个来自EAP模块,另一个版本来自jbpm应用程序war / lib文件夹。您必须禁用其中一个jar来解决此冲突。