Question

For a project I'm implementing a SOAP service using Apache Axis2 1.6.2. I have a service which needs to receive a file using MTOM. But sadly I keep having issues with receiving a MTOM attached file. I keep getting the exception:

org.apache.axiom.om.OMException: A data handler was not found for content id cid:491414508823

....

I've tried to search the web for an answer, but was not succesful. I hope someone can get me in the right direction. My wsdl contains the following snippet:

...
<xs:element minOccurs="0" name="PDF_Attachment">
  <xs:complexType>
     <xs:all>
         <xs:element minOccurs="0" name="PDF_AttachmentName" type="xs:string"/>
         <xs:element name="PDF_AttachmentContent" type="xs:base64Binary"/>
     </xs:all>
   </xs:complexType>
</xs:element>
...

I use SoapUI to generate the request and have set the property 'use MTOM' to true.

Is there anyone who has encountered the same problem or knows how to solve this. Help would be greatly appreciated!

Richard

UPDATE

I think I've tackled the problem. The issue was within my xsd/wsdl definitions. I used jaxb to convert my business objects defined in external xsd's to POJO with JAXB annotations. But the xs:base64Binary was converted as byte[]. Changing the xsd with:

<xs:schema ... xmlns:xmime="http://www.w3.org/2005/05/xmlmime"> ...

And changing the element to:

<xs:element name="PDF_AttachmentContent" minOccurs="1" maxOccurs="1" type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream">

JAXB now created a DataHandler as return type in the getPDF_AttatchmentContent. The only issue I have to tackle is to allow SOAPUI to send the MTOM attachments. Somehow A testclient I've created works perfectly, but SOAPUI does not send the attachment...

Source for the solution above: http://cxf.apache.org/docs/mtom-attachments-with-jaxb.html

UPDATE 2: http://ssagara.blogspot.nl/2012/03/test-axis2-jax-ws-mtom-service-using.html solved my SOAPUI issues with MTOM. I did not edit the correct cid in my soap message. I assumed that SOAPUI would assist me with that, but it didn't.

Was it helpful?

Solution

The details of the solution are in the original message above. The issues were resolved using the following two sites:

  1. DataHandler issue: http://cxf.apache.org/docs/mtom-attachments-with-jaxb.html
  2. SoapUI issue: http://ssagara.blogspot.nl/2012/03/test-axis2-jax-ws-mtom-service-using.html

I hope this is helpful for some of you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top