org.apache.axis2.AxisFault.makeFault 处的轴故障

AxisFault at org.apache.axis2.AxisFault.makeFault

当 运行 axis 客户端出现错误,我使用的是 axis2 版本 1.7.7

org.apache.axis2.AxisFault
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at ch.e_dec.www.services.edecservice.v2.ServiceStub.goodsDeclarations(EdecServiceStub.java:339)
at ch.e_dec.www.services.edecservice.EdecClient.main(EdecClient.java:318)
Caused by: java.lang.NullPointerException
at org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:78)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)

我已经检查了 axis2 1.4.1 版本,没有发现任何问题,并且对于升级轴版本相同的代码已经完成了最新版本 1.7.7

1.4.1版本成功,

contentType:Before:multipart/related; boundary="----=_Part_3837_17859151.1531477242209"
contentType:After:multipart/related; boundary="----=_Part_3837_17859151.1531477242209"; type="text/xml"

使用 axis2 1.4.1

时,类型变为 type="text/xml"

但是在axis2 1.7.7中,我检查的时候发现内容类型是null。所以空指针异常来了。我想知道为什么类型变成 null

contentType:Before:multipart/related; boundary="----=_Part_3837_17859151.1531477242209"
contentType:After:multipart/related; boundary="----=_Part_3837_17859151.1531477242209"; 

请帮助我。

Axis2 1.7.0 release notes 中所述的向后不兼容更改:

Apache Axis2 1.7.0 is a major release that contains lots of bug fixes and improvements, some of which introduce backward incompatible changes with respect to Axis2 1.6.x (as described below).

更具体地说:

.. application code should no longer assume that the Attachments object is set on the message context and contains all MIME parts of the message. Note that as of Axis2 1.7.0, this assumption is still true (because the JAX-WS implementation internally relies on this), but this will change in a subsequent release.

Class apache/axis2/builder/MIMEBuilder.javathis JIRA issue 上被提及。

您必须重构您的实现才能升级版本。