You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org> on 2010/12/24 15:27:47 UTC

[jira] Resolved: (AXIS2-3865) wsdl2java generates wrong code

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

Amila Chinthaka Suriarachchi resolved AXIS2-3865.
-------------------------------------------------

    Resolution: Won't Fix

now this code has moved to org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(reader) method. please report this issue in Axiom if you still have the problem.

> 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
>         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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org