[
https://issues.apache.org/jira/browse/AXIS2-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Veithen updated AXIS2-3865:
-----------------------------------
Fix Version/s: 1.6
Yes, the generated code now uses a utility method in Axiom, and this method
should work even if the underlying parser is non coalescing. The change will be
part of 1.6, and it is not mergeable to the 1.5 branch because there have been
too many other changes to that part of the code.
> wsdl2java generates wrong code
> ------------------------------
>
> Key: AXIS2-3865
> URL: https://issues.apache.org/jira/browse/AXIS2-3865
> Project: Axis2
> Issue Type: Bug
> Components: codegen
> Reporter: Thomas Freitag
> Assignee: Amila Chinthaka Suriarachchi
> Fix For: 1.6
>
> Attachments: ADBBeanTemplate.xsl
>
>
> I've this few lines in my wsdl
> <!-- createDocument -->
> <xsd:element name="createDocumentRequest">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element name="data" type="xsd:base64Binary"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> java2wsdl produces therefore the following code:
> if (isReaderMTOMAware(reader)
> &&
>
> java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY)))
> {
> //MTOM aware reader - get the
> datahandler directly and put it in the object
> object.setData(
>
> (javax.activation.DataHandler)
> reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER));
> } else {
> if (reader.getEventType() ==
> javax.xml.stream.XMLStreamConstants.START_ELEMENT &&
> reader.getName().equals(new
> javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI,
> org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE)))
> {
> java.lang.String id =
> org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8");
>
> object.setData(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder)
> ((org.apache.axiom.om.impl.llom.OMStAXWrapper)
> reader).getBuilder()).getDataHandler(id));
> reader.next();
>
> reader.next();
>
> } else if(reader.hasText()) {
> //Do the usual conversion
> java.lang.String content =
> reader.getText();
> object.setData(
>
> org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content));
>
> reader.next();
>
> }
> }
> But this will not work if the client side send the binary data in chunks,
> i.e. including new lines. Then only the first chunk (first line) will set. I
> changed the ADBBeanTemplate.xsl so that it will produce the following code:
> if (isReaderMTOMAware(reader)
> &&
>
> java.lang.Boolean.TRUE.equals(reader.getProperty(org.apache.axiom.om.OMConstants.IS_BINARY)))
> {
> //MTOM aware reader - get the
> datahandler directly and put it in the object
> object.setData(
>
> (javax.activation.DataHandler)
> reader.getProperty(org.apache.axiom.om.OMConstants.DATA_HANDLER));
> } else {
> if (reader.getEventType() ==
> javax.xml.stream.XMLStreamConstants.START_ELEMENT &&
> reader.getName().equals(new
> javax.xml.namespace.QName(org.apache.axiom.om.impl.MTOMConstants.XOP_NAMESPACE_URI,
> org.apache.axiom.om.impl.MTOMConstants.XOP_INCLUDE)))
> {
> java.lang.String id =
> org.apache.axiom.om.util.ElementHelper.getContentID(reader, "UTF-8");
>
> object.setData(((org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder)
> ((org.apache.axiom.om.impl.llom.OMStAXWrapper)
> reader).getBuilder()).getDataHandler(id));
> reader.next();
>
> reader.next();
>
> } else if(reader.hasText()) {
> //Do the usual conversion
> java.lang.StringBuffer content =
> new java.lang.StringBuffer();
> content.append(reader.getText());
>
> reader.next();
> while (!reader.isEndElement()
> && reader.hasText()) {
>
> content.append(reader.getText());
> reader.next();
> }
>
> object.setData(
>
> org.apache.axis2.databinding.utils.ConverterUtil.convertToBase64Binary(content.toString()));
> }
> }
>
> Now it works. If necessary I can send my changes
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]