[jbossws-users] [JBossWS] - enumerations in jboss ws...

mwiles do-not-reply at jboss.com
Mon Jan 29 12:47:59 EST 2007


I have an xsd which has an enumeration type:

	<xsd:simpleType name="IncomeTypeEnum">
		<xsd:restriction base="xsd:string">
			<xsd:enumeration value="pension" id="pension"/>
			<xsd:enumeration value="salary" />
		</xsd:restriction>
	</xsd:simpleType>

The mapping snippet for that enum looks like this:

    <java-xml-type-mapping>
        <java-type>za.co.sanlam.employeebenefits.IncomeTypeEnum</java-type>
        <root-type-qname xmlns:rtq="http://sanlam.co.za/employeebenefits/dto/1">rtq:IncomeTypeEnum</root-type-qname>
        <qname-scope>simpleType</qname-scope>
        <variable-mapping>
            <java-variable-name>pension</java-variable-name>
            <xml-element-name>pension</xml-element-name>
        </variable-mapping>
        <variable-mapping>
            <java-variable-name>salary</java-variable-name>
            <xml-element-name>salary</xml-element-name>
        </variable-mapping>
    </java-xml-type-mapping>

But when I deploy the web service I get the following error: 

19:10:45,359 ERROR [MainDeployer] Could not start deployment: file:/C:/usr/jboss-4.0.5.GA/server/default/tmp/deploy/tmp50100EAR.ear-contents/EJB.jar
org.jboss.ws.WSException: Attribute pension found in jaxrpc-mapping but not in the schema: {http://sanlam.co.za/employeebenefits/dto/1}IncomeTypeEnum
	at org.jboss.ws.jaxb.SchemaBindingBuilder.processXmlAttributeName(SchemaBindingBuilder.java:260)
	at org.jboss.ws.jaxb.SchemaBindingBuilder.processNonArrayType(SchemaBindingBuilder.java:207)
	at org.jboss.ws.jaxb.SchemaBindingBuilder.processJavaXmlTypeMapping(SchemaBindingBuilder.java:147)
	at org.jboss.ws.jaxb.SchemaBindingBuilder.bindSchemaToJava(SchemaBindingBuilder.java:119)
	at org.jboss.ws.jaxb.SchemaBindingBuilder.buildSchemaBinding(SchemaBindingBuilder.java:99)
	at org.jboss.ws.metadata.ServiceMetaData.getSchemaBinding(ServiceMetaData.java:332)
	at org.jboss.ws.metadata.ServiceMetaData.eagerInitialize(ServiceMetaData.java:400)
	at org.jboss.ws.metadata.UnifiedMetaData.eagerInitialize(UnifiedMetaData.java:147)
	at org.jboss.ws.server.ServiceEndpoint.start(ServiceEndpoint.java:106)
	at org.jboss.ws.server.ServiceEndpointManager.startServiceEndpoint(ServiceEndpointManager.java:529)
	at org.jboss.ws.deployment.ServiceEndpointDeployer.start(ServiceEndpointDeployer.java:144)
	at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:104)
	at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
	at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)

Has anyone done enumerations with jboss and could shed some light on what is going on? I 

The java code for the enumration is as follows...

It does not seem as this is the problem as if I remove the java class, the error persists.

public class IncomeTypeEnum  {
    private java.lang.String _value_;
    private static java.util.HashMap _table_ = new java.util.HashMap();

    // Constructor
    protected IncomeTypeEnum(java.lang.String value) {
        _value_ = value;
        _table_.put(_value_,this);
    };

    public static final java.lang.String _pension = "pension";
    public static final java.lang.String _salary = "salary";
    public static final IncomeTypeEnum pension = new IncomeTypeEnum(_pension);
    public static final IncomeTypeEnum salary = new IncomeTypeEnum(_salary);
    public java.lang.String getValue() { return _value_;}
    public static IncomeTypeEnum fromValue(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        IncomeTypeEnum enum = (IncomeTypeEnum)
            _table_.get(value);
        if (enum==null) throw new java.lang.IllegalArgumentException();
        return enum;
    }
    public static IncomeTypeEnum fromString(java.lang.String value)
          throws java.lang.IllegalArgumentException {
        return fromValue(value);
    }
    public boolean equals(java.lang.Object obj) {return (obj == this);}
    public int hashCode() { return toString().hashCode();}
    public java.lang.String toString() { return _value_;}

}

I've tried everything to find the answer to my problem but just can't get anything. Hopefully it's quite a simple solution.

Michael Wiles
Java Developer


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4007917#4007917

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4007917



More information about the jbossws-users mailing list