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 "Thomas Freitag (JIRA)" <ji...@apache.org> on 2008/06/17 16:45:45 UTC

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

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


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

Posted by keith chapman <ke...@gmail.com>.
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) <ji...@apache.org>
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: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


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

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

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

Posted by "Thomas Freitag (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Freitag updated AXIS2-3865:
----------------------------------

    Attachment: ADBBeanTemplate.xsl

this is the changed xsl

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


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

Posted by "Deepal Jayasinghe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Deepal Jayasinghe reassigned AXIS2-3865:
----------------------------------------

    Assignee: Amila Chinthaka Suriarachchi

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


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

Posted by "Thomas Freitag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610507#action_12610507 ] 

Thomas Freitag commented on AXIS2-3865:
---------------------------------------

The changed ADBBeanTemplate.xsl is already attached. I'm not really sure if my changes at all places are really correct. Please have a look at it

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


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

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610504#action_12610504 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-3865:
-----------------------------------------------------

Could you please attach a patch?

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