Hi Thomas,

Can you upload a patch (diff) to the Jira granting ASF licence. That will
make it easy to apply the patch and fix the issue.

Thanks,
Keith.

On Tue, Jun 17, 2008 at 8:15 PM, Thomas Freitag (JIRA) <[EMAIL PROTECTED]>
wrote:

> wsdl2java generates wrong code
> ------------------------------
>
>                 Key: AXIS2-3865
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3865
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: wsdl
>            Reporter: Thomas Freitag
>
>
> 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]
>
>


-- 
Keith Chapman
Senior Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog: http://www.keith-chapman.org

Reply via email to