Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-4973

MTOM attachment parsing issue with generated code



    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.5.4
    • None
    • codegen
    • JDK EE 6 with JRE 1.6.0_22


      Used a WSDL which have this attachment structure:
      <xs:complexType name="AttachmentType">
      <xs:element name="AttachmentName" type="xs:string" minOccurs="0"/>
      <xs:element name="AttachmentData" type="xs:base64Binary" minOccurs="0"/>

      this is inside of <xs:element name="Attachment" type="ns1:AttachmentType" minOccurs="0" maxOccurs="3"/>
      this is inside of a complex structure (let is be <MyStruct>) and that can be reoccur infinite times.

      I used the latest 1.5.4 axis2's wsdl2java with no extra options enabled to make a java stub for the client side.

      After getting a response with the required aforementioned structure, if there is no attachment then the parsing is ok.
      If there is an MTOM attachment (using <ns1:Include xmlns:ns1="http://www.w3.org/2004/08/xop/include" href="cid:this_is_anid"/> inside of AttachmentData tag) then the parsing have problems:

      • In some cases, I got unexpected subelement error to the next MyStruct which is after the currently parsed struct if there is an attachment inside of it. However, the attachment is retrieved if I try to remove the unexpected element exceptions manually.
      • in some other cases (added 2 other <Attachment/> tags after the first to be 3 attachment tags) the MyStruct structure which helds Attachment tag will be parsed successfully, but the second seems to be not AND I get an unexpected subelement for the next structure which is after MyStruct in the WSDL definition in the sequence.


      I have found the workaround for this lately
      generating code with this:
      <xs:simpleType name="AttachmentDataType">
      <xs:restriction base="xs:base64Binary" />
      <xs:complexType name="AttachmentType">
      <xs:element name="AttachmentName" type="xs:string" minOccurs="0"/>
      <xs:element name="AttachmentData" type="ns1:AttachmentDataType" minOccurs="0"/>

      This will give a code which doesn't fail on attachments.




            Unassigned Unassigned
            n3whous3 Újházi, Béla
            0 Vote for this issue
            0 Start watching this issue