[ 
https://issues.apache.org/jira/browse/AXIS2-4973?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Újházi, Béla updated AXIS2-4973:
--------------------------------

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

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.

Problem:
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:simpleType>
...
<xs:complexType name="AttachmentType">
   <xs:sequence>
      <xs:element name="AttachmentName" type="xs:string" minOccurs="0"/>
      <xs:element name="AttachmentData" type="ns1:AttachmentDataType" 
minOccurs="0"/>
   </xs:sequence>
</xs:complexType>

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

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

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.

Problem:
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.


> MTOM attachment parsing issue with generated code
> -------------------------------------------------
>
>                 Key: AXIS2-4973
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4973
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.5.4
>         Environment: JDK EE 6 with JRE 1.6.0_22
>            Reporter: Újházi, Béla
>              Labels: mtom, wsdl2java
>
> Input:
> Used a WSDL which have this attachment structure:
> <xs:complexType name="AttachmentType">
>      <xs:sequence>
>         <xs:element name="AttachmentName" type="xs:string" minOccurs="0"/>
>         <xs:element name="AttachmentData" type="xs:base64Binary" 
> minOccurs="0"/>
>     </xs:sequence>
> </xs:complexType>
> 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.
> Problem:
> 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:simpleType>
> ...
> <xs:complexType name="AttachmentType">
>    <xs:sequence>
>       <xs:element name="AttachmentName" type="xs:string" minOccurs="0"/>
>       <xs:element name="AttachmentData" type="ns1:AttachmentDataType" 
> minOccurs="0"/>
>    </xs:sequence>
> </xs:complexType>
> This will give a code which doesn't fail on attachments.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org
For additional commands, e-mail: java-dev-h...@axis.apache.org

Reply via email to