Resent as earlier attempt failed...

________________________________
From: Pantvaidya, Vishwajit
Sent: Tuesday, December 11, 2007 5:00 PM
To: [email protected]
Subject: RE: [Axis2] MTOM Exception with Axis2 1.3 
"org.apache.axis2.databinding.ADBException: Unexpected subelement Buffer"

I found out that I was able to send MTOM attachments to the .NET client - so 
the problem was only during receipt of an MTOM attachment from .NET2.0 WSE 3.0. 
Even that receipt issue I have resolved temporarily by changing my MTOM schema 
definition so as to have the base64binary element as the last one in the 
message. The question is: why does the MTOM element have to be the last one? Is 
this a bug in axis2?

It seems to me that this issue and the other one I mentioned earlier 
(https://issues.apache.org/jira/browse/AXIS2-3196) means that MTOM does not 
work with Axis2 1.3 GA release. Will there be a patch release that fixes these 
issues?

Here are the schema changes (highlighted in red) I had to make to get inbound 
MTOM attachments working:

<s:complexType name="AttachmentType">
            <s:sequence>
                        <s:element name="AttachmentData" type="s:base64Binary" 
minOccurs="0" maxOccurs="1"/>
            </s:sequence>
</s:complexType>

---------------------------------------------------------------------------------------------------------------------------------
Schema that gave "Unexpected subelement Buffer" exception for inbound MTOM 
attachments:
<s:element name="AppendChunkRequestElement">
            <s:complexType>
                        <s:sequence>
                                    <s:element 
name="ClientWorkingFolderOnServer" type="s:string"></s:element>
                                    <s:element name="FileName" 
type="s:string"></s:element>
                                    <s:element name="Buffer" 
type="tns:AttachmentType"></s:element>
                                    <s:element name="Offset" 
type="s:long"></s:element>
                                    <s:element name="BytesRead" 
type="s:int"></s:element>
                        </s:sequence>
            </s:complexType>
</s:element>
---------------------------------------------------------------------------------------------------------------------------------
Schema that worked:
<s:element name="AppendChunkRequestElement">
            <s:complexType>
                        <s:sequence>
                                    <s:element 
name="ClientWorkingFolderOnServer" type="s:string"></s:element>
                                    <s:element name="FileName" 
type="s:string"></s:element>
                                    <s:element name="Offset" 
type="s:long"></s:element>
                                    <s:element name="BytesRead" 
type="s:int"></s:element>
                                    <s:element name="Buffer" 
type="tns:AttachmentType"></s:element>
                        </s:sequence>
            </s:complexType>
</s:element>
---------------------------------------------------------------------------------------------------------------------------------

Thanks,

Vish.

________________________________
From: Pantvaidya, Vishwajit [mailto:[EMAIL PROTECTED]
Sent: Friday, December 07, 2007 12:19 AM
To: [email protected]
Subject: RE: [Axis2] MTOM Exception with Axis2 1.3 
"org.apache.axis2.databinding.ADBException: Unexpected subelement Buffer"

Hi Amila,

I do not have the .NET service right now to try it out - but I am attaching a 
snapshot taken earlier of the request from the .NET service captured in tcpmon. 
From that, I see that the AppendChunkRequestElement has namespace= 
xmlns="http://ws.selectica.com/ecm/";

The if condition in AppendChunkRequestElement.java is "if 
(reader.isStartElement() && new 
javax.xml.namespace.QName("http://ws.selectica.com/ecm/","Offset";).equals(reader.getName()))"
 - it does not enter that if body. The else part does not do anything other 
than throw the above exception.


- Vish.

________________________________
From: Amila Suriarachchi [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 06, 2007 9:53 PM
To: [email protected]
Subject: Re: [Axis2] MTOM Exception with Axis2 1.3 
"org.apache.axis2.databinding.ADBException: Unexpected subelement Buffer"


On Dec 7, 2007 10:49 AM, Pantvaidya, Vishwajit <[EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>> wrote:

I am using Axis2 1.3 to receive a pdf doc using MTOM from a .NET 2.0 WSE 3.0 C# 
client. I am already using an axiom jar from a nightly build that has Thilina's 
patch 
(https://issues.apache.org/jira/browse/AXIS2-3196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541070
 ).



I get the above error in the AppendChunkRequestElement class created by 
wsdl2java when it tries to parse the MTOM request received from .NET. The .NET 
client creates a byte array and sets it into the AttachmentData element. The 
complete request element is defined in wsdl as follows:



<s:complexType name="AttachmentType">



               <s:sequence>

                               <

s:element maxOccurs="1" minOccurs="0" name="AttachmentData" 
type="s:base64Binary"

/>

               </s:sequence>



</s:complexType>

<s:element

 name="AppendChunkRequestElement">

               <s:complexType>

                               <s:sequence>



                                              <s:element 
name="ClientWorkingFolderOnServer" type="s:string"/>

                                              <s:element name="FileName"

type="s:string"/>

                                              <

s:element name="Buffer" type="tns:AttachmentType"/>



                                              <s:element name="Offset" 
type="s:long"/>



                                              <s:element name="BytesRead" 
type="s:int"

/>

                               </s:sequence>



               </s:complexType>

</s:element

>



After stepping thru the factory code I see that it parses Buffer and expects 
Offset next. As far as I can see from Eclipse variables snapshot, the next 
element is Offset. But for some reason it does not find it and throws above 
error.
Does this match the namespce as well. if you go through the parse method you 
can see there is an if statement for this. does it go inside the if statement?
Can you paste that code?

thanks,
Amila.



Strangest thing is - I asked the .NET client guy to set a non-binary bytearray 
like byte[0]=0,byte[1]=1, etc into AttachmentData element and send it thru' 
MTOM and then it works. Why does it not work with the PDF file byte[].



Does the .NET client have to transform the file into a base64 encoded array 
before sending it to me? Any other suggestions?





Thanks,



Vish.



--
Amila Suriarachchi,
WSO2 Inc.

Reply via email to