axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Chinthaka Suriarachchi (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AXIS2-3865) wsdl2java generates wrong code
Date Fri, 04 Jul 2008 09:43:41 GMT

    [ 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


Mime
View raw message