1 Reply Latest reply on Jan 31, 2007 2:03 PM by Tejas Jani

    urgent: java enums and mapping file...

    Tejas Jani Newbie

      Hi all...

      I am in urgent need of help.

      I have some enum types defined in my schema. I have already written the associated enum type classes for them as described in some other posts here.

      Now, I am not able to figure out how to change the jaxrpc-mapping file to map the xml enum types to the Java type classes.

      I have looked for answers in a lot of places but could not find it.

      Pls. help.


      Here is the enum type
      <xsd:simpleType name="StatusType">

      <xsd:restriction base="xsd:string">

      <!-- The operation was successful. -->
      <xsd:enumeration value="Success" />

      <!-- An error occured while processing the request. -->
      <xsd:enumeration value="SystemError" />

      <!-- An error occurred due to input given from the user -->
      <xsd:enumeration value="UserError" />


      Here is its Java type:

      import java.io.Serializable;

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

      // Constructor
      protected StatusType(java.lang.String value)
      _value_ = value;

      public static final java.lang.String _SUCCESS = "Success";
      public static final java.lang.String _SYSTEMERROR = "SystemError";
      public static final java.lang.String _USERERROR = "UserError";
      public static final StatusType SUCCESS = new StatusType(_SUCCESS);
      public static final StatusType USERERROR = new StatusType(_USERERROR);
      public static final StatusType SYSTEMERROR = new StatusType(_SYSTEMERROR);

      public java.lang.String getValue() { return _value_;}
      public static StatusType fromValue(java.lang.String value)
      throws java.lang.IllegalArgumentException
      StatusType enumeration = (StatusType)_table_.get(value);
      if (enumeration==null) throw new java.lang.IllegalArgumentException();
      return enumeration;
      public static StatusType 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_;}
      public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}


        • 1. Re: urgent: java enums and mapping file...
          Tejas Jani Newbie

          can someone pls. help here...I am really stuck here and am not able to proceed any further.

          When I try to call the service without any mappings defined in the mapping file it throws a org.jboss.xb.binding.JBossXBRuntimeException error.

          any hlp is highly appreciated.


          javax.xml.rpc.JAXRPCException: org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed t
          rse source: Failed to set value 'Ad' for property 'detailType' defined in com.demandtec.webservices.heb.PromotionDet
          1d70d74 on instance com.demandtec.webservices.heb.PromotionDetail@1d70d74