views:

24

answers:

0

After looking around and trying different suggested solutions, I’m writing this. The 2 most common solutions suggested to extract binary data from a MTOM/non-MTOM SOAP message are:

  1. Retrieve the OMText node, and use the dataHandler instance present within it
  2. Find the OMElement node which contains the ‘href’ attribute. Get the ‘cid:xxxxx’ value, and use the ‘xxxxx’ part to retrieve the attachment from the attachment map present in the message context instance.

The problem I’m facing is that my client indicates that the SOAP response message is MTOM [I determined this using the isDoingMTOM() method of the message context instance]. However, there are no OMElement nodes which contain the ‘href’ attribute. On printing the SOAP envelope, I found that the binary data is present inline within the body. So I tried the OMText node approach to get the data, but whenever I try to cast the OMElement to the corresponding OMText node, I keep getting a classCastException.

Can someone point out what I’m missing out on?