Hi,

We are receiving two elements from the SOAP response. The first element is
MTOM that contains the base64Binary data. The second element is a simple
String.

I am using maven axis2-wsdl2code-maven-plugin to generate the java code from
wsdl.

The maven generate the below code snippet

*************************************************************************************************************************************

                                  *if* (reader.isStartElement() && *new*
javax.xml.namespace.QName("http://adobe.com/idp/services","MTOM";
).equals(reader.getName())){
                                reader.next();
                                    *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.setMTOM(

(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.setMTOM(((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.setMTOM(

org.apache.axis2.databinding.utils.ConverterUtil.*convertToBase64Binary*
(content));

                                                reader.next();

                                        }
                                    }


                                        reader.next();
                              }

***********************************************************************************************************************************

Actually the above code snippet parses the first element "MTOM" and then it
could not able to parse the second element "a simple string element"
If i add the below code snippet, it could able to parse the second element

                                    *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.setMTOM(

(javax.activation.DataHandler)
reader.getProperty(org.apache.axiom.om.OMConstants.*DATA_HANDLER*));
*reader.next()*
*
*
*
*
Can you please check why the parse could not able to handle the SOAP
response that has MTOM element followed by a simple element of type string?

Is it a bug in Axis2?

Thanks,
Gandhirajan

                                    }

Reply via email to