[ https://issues.apache.org/jira/browse/AXIS2-2541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12833006#action_12833006 ]
Lukasz Nieweglowski commented on AXIS2-2541: -------------------------------------------- I've spent some time investigating this issue and I've found how to send and array of DataHandlers using MTOM. There is a difference for Axis2 engine how you define your array of binary types in WSDL file. When I used: <xsd:complexType name="BinaryItemArrayType"> <xsd:sequence> <xsd:element name="BinaryData" maxOccurs="1" minOccurs="1" type="xsd:base64Binary"/> </xsd:sequence> </xsd:complexType> then Axis2 was able to sent data using MTOM but when I tried to do it this way: <xsd:element name="BinaryData" type="xsd:base64Binary"/> <xsd:complexType name="BinaryItemArrayType"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="1" ref="BinaryData"/> </xsd:sequence> </xsd:complexType> then all my data was sent inside SOAP message using standard base64 encoding. It is visible nicely when you mix these two approaches. To do that just put this type into WSDL file and us it to send multiple DataHandlers assigned to BinaryData and InternalBinaryData: <xsd:element name="BinaryData" type="xsd:base64Binary"/> <xsd:complexType name="BinaryItemArrayType"> <xsd:sequence> <xsd:element name="InternalBinaryData" maxOccurs="1" minOccurs="1" type="xsd:base64Binary"/> <xsd:element maxOccurs="1" minOccurs="1" ref="BinaryData"/> </xsd:sequence> </xsd:complexType> >From my point of view this is still a bug. We have two ways of defining data >type in WSDL file which are logically equal but behavior is different. Tested on Linux, Apache Tomcat 5.5.27, Axis2 1.5.1. > MTOM not using references for array of DataHandlers > --------------------------------------------------- > > Key: AXIS2-2541 > URL: https://issues.apache.org/jira/browse/AXIS2-2541 > Project: Axis2 > Issue Type: Bug > Components: transports > Affects Versions: 1.1.1 > Environment: Client is written in java and running on Windows XP > Reporter: Valerie Masin > Assignee: Thilina Gunarathne > Attachments: composite.wsdl, DocHarborWebServices.java, > file123-1.txt, file123-2.txt > > > One of my datatypes is an array of DataHandlers (DataHandler[]). (I got the > wsdl to generate this by setting my base64Binary's maxOccurs to unbounded) > > When I set the client to use MTOM I had expected to see each of these > base64Binary objects as separate references to entities outside the soap > message. However, when viewing the soap message with tcpmon, they are being > sent 'by value'. If I don't use an array then the binary data is sent > correctly outside the soap message. > > Here is what I see (reformatted for clarity). Under <ns1:documents> the > document (which is only 8 bytes) is embedded in the message rather than > referencing outside. > > POST /webservices2_0e/services/DocHarborServices HTTP/1.1 > SOAPAction: "urn:compositeCreateDocument" > User-Agent: Axis2 > Host: us00wl00.devportal.net:30004 > Content-Length: 691 > Content-Type: multipart/related; > boundary=MIMEBoundaryurn_uuid_FA25913A7339BC61F81176744499225; > type="application/xop+xml"; > start="<0.urn:uuid:fa25913a7339bc61f81176744499...@apache.org>"; > start-info="text/xml"; charset=UTF-8 > --MIMEBoundaryurn_uuid_FA25913A7339BC61F81176744499225 > content-type: application/xop+xml; charset=UTF-8; type="text/xml"; > content-transfer-encoding: binary > content-id: <0.urn:uuid:fa25913a7339bc61f81176744499...@apache.org> > <?xml version='1.0' encoding='UTF-8'?> > <soapenv:Envelope > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header /> > <soapenv:Body> > <ns1:compositeCreateDocument xmlns:ns1="urn:webservices.docharbor.com"> > <ns1:user>idsuser</ns1:user> > <ns1:documents>MTIzLS0tLTENCg==</ns1:documents> > <ns1:documents>MTIzLS0tLTINCg==</ns1:documents> > </ns1:compositeCreateDocument> > </soapenv:Body> > </soapenv:Envelope> > --MIMEBoundaryurn_uuid_FA25913A7339BC61F81176744499225-- -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.