axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ilab (Created) (JIRA)" <>
Subject [jira] [Created] (AXIS2-5162) Bad parser code is generated from wsdl in certain cases
Date Thu, 06 Oct 2011 13:20:30 GMT
Bad parser code is generated from wsdl in certain cases

                 Key: AXIS2-5162
             Project: Axis2
          Issue Type: Bug
          Components: codegen
    Affects Versions: 1.6.1
         Environment: Windows7x64 (don't think to be relevant)
            Reporter: ilab
            Priority: Blocker

For the wsdl example you can find below, axis2 v1.6.1 (v.1.5.1 and possibly older versions
also) generates bad parse code as the resulted service doesn't accept a valid message (also
see below). 

If you send the message with empty Data1 tag, it is parsed successfully. With content, which
is also valid, the parser results "org.apache.axis2.databinding.ADBException: Unexpected subelement

The actual problem is that the generated parse code does not deal with the content of Data1
tag, therefore, if it is not empty, after parsing Data1, the parse pointer will be at the
end element of Data1, instead of being after it. I have also copy-pasted the buggy code below,

Rejected message

<soapenv:Envelope xmlns:soapenv="" xmlns:test="http://test">

Accepted message
<soapenv:Envelope xmlns:soapenv="" xmlns:test="http://test">

WSDL example

<?xml version="1.0" encoding="UTF-8"?>

<definitions xmlns="" 

		<xsd:schema targetNamespace="http://test" elementFormDefault="qualified">

			<xsd:complexType name="CodeType">
					<xsd:extension base="xsd:normalizedString"/>

			<xsd:complexType name="ElementType">
					<xsd:extension base="ns:CodeType"/>

			<xsd:complexType name="QueryTestEBMType">
					<xsd:element name="Data1" type="ns:ElementType" maxOccurs="1"/>
					<xsd:element name="Data2" type="ns:ElementType" maxOccurs="1"/>

			<xsd:element name="QueryTestEBM" type="ns:QueryTestEBMType"/>

	<message name="QueryTestReqMsg">
		<part name="QueryTestEBM" element="ns:QueryTestEBM"/>

	<message name="QueryTestRespMsg">

	<portType name="TestBindingPort">
		<operation name="QueryTest">
			<input message="ns:QueryTestReqMsg"/>
			<output message="ns:QueryTestRespMsg"/>

	<binding name="TestBinding" type="ns:TestBindingPort">
		<soap:binding style="document" transport="" />
		<operation name="QueryTest">
			<soap:operation soapAction="QueryTest" />
				<soap:body use="literal" />
				<soap:body use="literal" />

	<service name="TestService">
		<port name="TestService" binding="ns:TestBinding">
				location="http://localhost:8080/WebServiceTest2/services/TestService" />

Buggy code: ElementType$Factory.parse()

        public static ElementType parse( reader) throws java.lang.Exception{
            ElementType object =
                new ElementType();

            int event;
            java.lang.String nillableValue = null;
            java.lang.String prefix ="";
            java.lang.String namespaceuri ="";
            try {
                while (!reader.isStartElement() && !reader.isEndElement())

                if (reader.getAttributeValue("","type")!=null){
                  java.lang.String fullTypeName = reader.getAttributeValue("",
                  if (fullTypeName!=null){
                    java.lang.String nsPrefix = null;
                    if (fullTypeName.indexOf(":") > -1){
                        nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
                    nsPrefix = nsPrefix==null?"":nsPrefix;

                    java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":")+1);
                            if (!"ElementType".equals(type)){
                                //find namespace for the prefix
                                java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
                                return (ElementType)test.ExtensionMapper.getTypeObject(




                // Note all attributes that were handled. Used to differ normal attributes
                // from anyAttributes.
                java.util.Vector handledAttributes = new java.util.Vector();


            } catch ( e) {
                throw new java.lang.Exception(e);

            return object;

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message