2

I have an error when running axis client, i'm using axis2 version 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)

I have checked with axis2 1.4.1 version , there is no issue found , And for upgrading axis version same code has done with latest version 1.7.7

In 1.4.1 version it was successful,

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

The type is getting as type="text/xml" while using axis2 1.4.1

but in axis2 1.7.7 , when i checked it is found that the content type is null . so null pointer exception is coming . i want to know why the type is getting as null

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

please help me.

LMC
  • 10,453
  • 2
  • 27
  • 52
Sarath
  • 608
  • 4
  • 12
  • Possible duplicate of [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – Dima Kozhevin Jul 13 '18 at 12:51
  • sorry its not a duplicate of https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it – Sarath Jul 13 '18 at 13:04
  • `Caused by: java.lang.NullPointerException at org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:78) ` – Dima Kozhevin Jul 13 '18 at 13:20

1 Answers1

2

Backward incompatible changes as described in 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).

More specifically:

.. 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.java is mentioned on this JIRA issue.

You have to refactor your implementation to be able to upgrade the version.

LMC
  • 10,453
  • 2
  • 27
  • 52
  • Thank you very much for your reply. – Sarath Jul 24 '18 at 08:40
  • Is the same case , the following error occurs ? org.apache.axiom.om.OMException: Invalid Application type. Support available for MTOM & SwA only. at org.apache.axiom.attachments.Attachments.getAttachmentSpecType(Attachments.java:310) at org.apache.axis2.builder.MIMEBuilder.processDocument(MIMEBuilder.java:60) at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:164) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:112) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:88) – Sarath Jul 24 '18 at 08:46
  • Looks related but not the same. Perhaps you are using a deprecated application type. – LMC Jul 24 '18 at 16:59
  • The type is setting as text/xml , and it is the application type for soap1.1 . The case is that we can handle only the client part. The server is different and we can't modify server part. – Sarath Jul 26 '18 at 12:23
  • Are you trying to send a message with attachment or receive one? If receiving, can you capture the arriving response and post it (without sensitive data)? – LMC Jul 26 '18 at 17:05
  • I am trying to send message as client, and normally while using axis2 1.4.1 getting response xml and attachment. The issue is getting while using 1.7.8 and when debugging it is found that the exception is coming in OutInAxisOperationClient.handleResponse method , while calling createSOAPMessage. So I assume that some response is coming and while processing the response error is coming. When debugging there is value in responseMessageContext and there does not exist the part type="text/xml" in response message context – Sarath Jul 27 '18 at 08:41
  • How about the response headers? May be there's something there. OTH it seems that you are getting a correct response but not being able to parse it? – LMC Jul 27 '18 at 13:52
  • Look at [this](https://community.blackboard.com/thread/4609-migrating-from-axis2-162-to-axis2-175-overall-approach#comment-16837), it may help. – LMC Jul 27 '18 at 14:01