axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frederick N. Brier (JIRA)" <>
Subject [jira] Commented: (AXIS-2096) Custom simpleType as attribute of an element causes problems when displaying deployed service's WSDL
Date Sun, 19 Nov 2006 23:57:02 GMT
    [ ] 
Frederick N. Brier commented on AXIS-2096:

I am just going to add a little more to what my investigations to what seems like the same
problem.  Enumeration restrictions cause a new Java class to be generated which means problems
trying to specify a Java primitive which does not have, nor need a serializer/deserializer
using SimpleSerializerFactory/SimpleDeserializerFactory.  In addition, this looks a lot like
JIRA bug#AXIS-2227, so perhaps we can kill two birds with one stone.

WSDL2Java is generating incorrect code in 3 places: deploy.wsdd, the *, and
the bean containing the string with the restriction base on it.  When I modify these files
as described below, the problem goes away.  I have hacked out a patch for the moment so I
can get my current task done, but the problem really requires taking the time to understand
the underlying data model for the WSDL and schema, which I have not yet done.

The problem with the deploy.wsdd is in, method writeDeployTypes() is
that mappings like the one below are being generated:


I added the following conditional which prevents it from being output for java.lang primitives:

                   if ( ! javaType.startsWith( "java.lang." ) )
                      //###FNB: Patch to stop output of primitives.
                    writeTypeMapping(pw, namespaceURI, localPart, javaType,
                        serializerFactory, deserializerFactory,

The problem in the * file was caused by a problem in the
 It was outputting the following unnecessary lines:

            qName = new javax.xml.namespace.QName("",
            cls = java.lang.String.class;
cls, qName));
cls, qName));

I addressed this in the writeSerializationInit() method by sticking in these two lines:

       //###FNB: Stop generation of java.lang primitives.
       if ( type.getName().startsWith( "java.lang." ) )

The problem with the bean containing the string with the restriction base on it was the setXmlType()

        elemField.setXmlName(new javax.xml.namespace.QName("",
        elemField.setXmlType(new javax.xml.namespace.QName("",

The second line should actually be:

        elemField.setXmlType(new javax.xml.namespace.QName("",

In, in the writeMetaData() method, I added this conditional.  This
by the way is a BUG in waiting.  Restrictions on other primitive types will barf all over
this.  I just don't have the time until after Thankgiving to look at underlying Axis schema

                      //###FNB: Attempt to fix bug in restriction types for strings.
                         if ( elemType.getName().startsWith( "java.lang.String" ) )
                            pw.println("        elemField.setXmlType( new javax.xml.namespace.QName(\"\",
\"string\" ) );");
                            pw.println("        elemField.setXmlType("
                                    + Utils.getNewQName(xmlType) + ");");

Hopefully this will help the Axis developers if they want to fix this now, or some other developer
who encounters this bug.  If I can get around to it, I will come up with a real fix and submit
a patch.

> Custom simpleType as attribute of an element causes problems when displaying deployed
service's WSDL
> ----------------------------------------------------------------------------------------------------
>                 Key: AXIS-2096
>                 URL:
>             Project: Apache Axis
>          Issue Type: Bug
>          Components: Serialization/Deserialization
>    Affects Versions: 1.2.1
>         Environment: WinXP, Tomcat 5.5.9, jdk1.5.0_03
>            Reporter: Daniel Kador
> If you create a WSDL similar to the one below in wrapped/literal style, you will not
be able to create a complexType whose attribute is of a custom simpleType.  In the example
below, the following error is listed when you try to view the deployed service's WSDL through
the browser interface:
> AXIS error
> Sorry, something seems to have gone wrong... here are the details:
> Fault - Bean attribute testAttribute is of type org.apache.axis.types.NormalizedString,
which is not a simple type
> AxisFault
>  faultCode: {}Server.generalException
>  faultSubcode: 
>  faultString: Bean attribute testAttribute is of type org.apache.axis.types.NormalizedString,
which is not a simple type
>  faultActor: 
>  faultNode: 
>  faultDetail: 
> 	{}hostname:ORLIWG2H5Y61
> I can fix the above error by changing the attribute type from "y:testAttribute" to "xs:normalizedString".
 Is Axis designed to behave this way?  It's my understanding that XML allows for custom simpleTypes
to be defined and then used as attributes, and the schemas I work with use this feature a
good deal.  They validate with no problems in XMLSpy.  The WSDL I use in this example is posted
> <?xml version="1.0" encoding="utf-8"?>
> <wsdl:definitions xmlns:wsdl="" 											xmlns:soap=""
> 			xmlns:http="" 
> 			xmlns:xs="" 
> 			xmlns:y="http://test.wsdl" 
> 			xmlns:types="http://test.wsdl/types"
> 			targetNamespace="http://test.wsdl">
> 	<wsdl:types>
> 		<xs:schema>
> 			<xs:complexType name="testType">
> 				<xs:sequence>
> 					<xs:element name="testElement" type="xs:normalizedString"/>
> 				</xs:sequence>
> 				<xs:attribute name="testAttribute" type="y:testAttribute"/>
> 			</xs:complexType>
> 			<xs:simpleType name="testAttribute">
> 				<xs:restriction base="xs:normalizedString"/>
> 			</xs:simpleType>
> 			<xs:element name="testAction">
> 				<xs:complexType>
> 					<xs:sequence>
> 						<xs:element name="testParam" type="y:testType"/>
> 					</xs:sequence>
> 				</xs:complexType>
> 			</xs:element>
> 			<xs:element name="testActionResp">
> 				<xs:complexType>
> 					<xs:sequence>
> 						<xs:element name="testResp" type="xs:string"/>
> 					</xs:sequence>
> 				</xs:complexType>
> 			</xs:element>
> 		</xs:schema>
> 	</wsdl:types>
> 	<wsdl:message name="testActionRequest">
> 		<wsdl:part name="parameters" element="y:testAction"/>
> 	</wsdl:message>
> 	<wsdl:message name="testActionResponse">
> 		<wsdl:part name="parameters" element="y:testActionResp"/>
> 	</wsdl:message>
> 	<wsdl:portType name="testPortType">
> 		<wsdl:operation name="testAction">
> 			<wsdl:input message="y:testActionRequest"/>
> 			<wsdl:output message="y:testActionResponse"/>
> 		</wsdl:operation>
> 	</wsdl:portType>
> 	<wsdl:binding name="testSoapBinding" type="y:testPortType">
> 		<soap:binding transport="" style="document"/>
> 		<wsdl:operation name="testAction">
> 			<wsdl:input>
> 				<soap:body use="literal"/>
> 			</wsdl:input>
> 			<wsdl:output>
> 				<soap:body use="literal"/>
> 			</wsdl:output>
> 		</wsdl:operation>
> 	</wsdl:binding>
> 	<wsdl:service name="testService">
> 		<wsdl:port name="testPort" binding="y:testSoapBinding">
> 			<soap:address location="http://localhost:8080/axis/services/testPort"/>
> 		</wsdl:port>
> 	</wsdl:service>
> </wsdl:definitions>

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


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

View raw message