解决webservice接口调用报错:java.lang.ClassFormatError: Absent Code ... javax/mail/internet/MimeMultip
今天使用java axis调用.net发布的webservice接口报了个错,排查半天,感觉代码逻辑没问题,最后发现是jar包冲突!!!
调用接口相关代码:
String url="http://xxxx/WebService/ForDxService.asmx?wsdl";
Service service = new Service();
Call call;
try {
call = (Call) service.createCall();
try {
call.setTargetEndpointAddress(new java.net.URL(url));
} catch (MalformedURLException e) {
e.printStackTrace();
}
call.setUseSOAPAction(true);
call.setSOAPActionURI(soapActionURI);
call.setOperationName(new QName(namespace,"GetOAInterface"));
call.addParameter(new QName(namespace,"strUnitCode"), //设置要传递的参数
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(namespace,"strExchangeType"),
org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.setReturnType(XMLType.XSD_SCHEMA);
String[] str = new String[2];
str[0] = "A_101247";
str[1] = "Document";
Object obj = call.invoke(str);
javax/mail/internet/MimeMultipart
在以下两个Jar包中都存在!
javaee-api-5.jar和javax.mail.jar两个jar包冲突,删掉javaee-api-5.jar即可。