users@jax-rpc.java.net

Re: invalid type for JAX-RPC structure

From: Doug Kohlert <Doug.Kohlert_at_Sun.COM>
Date: Mon, 11 Jul 2005 10:57:38 -0700

Brad,
JAX-RPC generated enum types cannot be used to generate WSDL. This is
because the JAX-RPC 1.1 specification did not specify such a mapping.

Baker, Brad (Contr) wrote:

>Hi all,
>
>I thought I had this one solved but I don't.
>I am triing to generate a Server from a supplied WSDL.
>
>I get the following error when I build from the WSDL.
>PayloadType does not have a public accessible empty constructor
>
>WSDL frag:
><s:element name="PayloadType">
> <s:annotation>
> <s:documentation>An enumeration of entity types used to
>specify which type of record is being sent</s:documentation>
> </s:annotation>
> <s:simpleType>
> <s:restriction base="s:string">
> <s:enumeration value="INDIV"/>
> <s:enumeration value="FACIL"/>
> <s:enumeration value="ORGAN"/>
> <s:enumeration value="EQUIP"/>
> <s:enumeration value="EVENT"/>
> </s:restriction>
> </s:simpleType>
></s:element>
>
>When I modify the generated class to have a public constructor I get:
>"invalid type for JAX-RPC structure: PayloadType"
>
>Now the class that the WSDL creates is basically an enum type. Why does
>it have problems with a class that it generated?
>
>Any work around would be welcomed!
>
>Brad
>
>This is the generated java class plus my default constructor:
>
>//This class was generated by the JAXRPC SI, do not edit.
>//Contents subject to change without notice.
>//JAX-RPC Standard Implementation (1.1.3, build R1)
>//Generated source version: 1.1.3
>
>package com.ngms.chims.dcgs.update;
>
>import java.util.HashMap;
>
>public class PayloadType {
> private java.lang.String value;
> private static java.util.Map valueMap = new HashMap();
> public static final java.lang.String _INDIVString = "INDIV";
> public static final java.lang.String _FACILString = "FACIL";
> public static final java.lang.String _ORGANString = "ORGAN";
> public static final java.lang.String _EQUIPString = "EQUIP";
> public static final java.lang.String _EVENTString = "EVENT";
>
> public static final java.lang.String _INDIV = new
>java.lang.String(_INDIVString);
> public static final java.lang.String _FACIL = new
>java.lang.String(_FACILString);
> public static final java.lang.String _ORGAN = new
>java.lang.String(_ORGANString);
> public static final java.lang.String _EQUIP = new
>java.lang.String(_EQUIPString);
> public static final java.lang.String _EVENT = new
>java.lang.String(_EVENTString);
>
> public static final PayloadType INDIV = new PayloadType(_INDIV);
> public static final PayloadType FACIL = new PayloadType(_FACIL);
> public static final PayloadType ORGAN = new PayloadType(_ORGAN);
> public static final PayloadType EQUIP = new PayloadType(_EQUIP);
> public static final PayloadType EVENT = new PayloadType(_EVENT);
>
> public PayloadType()
> {
> this.value = "NONE";
> valueMap.put(this.toString(), this);
> }
>
> protected PayloadType(java.lang.String value) {
> this.value = value;
> valueMap.put(this.toString(), this);
> }
>
> public java.lang.String getValue() {
> return value;
> }
>
> public static PayloadType fromValue(java.lang.String value)
> throws java.lang.IllegalStateException {
> if (INDIV.value.equals(value)) {
> return INDIV;
> } else if (FACIL.value.equals(value)) {
> return FACIL;
> } else if (ORGAN.value.equals(value)) {
> return ORGAN;
> } else if (EQUIP.value.equals(value)) {
> return EQUIP;
> } else if (EVENT.value.equals(value)) {
> return EVENT;
> }
> throw new java.lang.IllegalArgumentException();
> }
>
> public static PayloadType fromString(java.lang.String value)
> throws java.lang.IllegalStateException {
> PayloadType ret = (PayloadType)valueMap.get(value);
> if (ret != null) {
> return ret;
> }
> if (value.equals(_INDIVString)) {
> return INDIV;
> } else if (value.equals(_FACILString)) {
> return FACIL;
> } else if (value.equals(_ORGANString)) {
> return ORGAN;
> } else if (value.equals(_EQUIPString)) {
> return EQUIP;
> } else if (value.equals(_EVENTString)) {
> return EVENT;
> }
> throw new IllegalArgumentException();
> }
>
> public java.lang.String toString() {
> return value.toString();
> }
>
> private java.lang.Object readResolve()
> throws java.io.ObjectStreamException {
> return fromValue(getValue());
> }
>
> public boolean equals(java.lang.Object obj) {
> if (!(obj instanceof PayloadType)) {
> return false;
> }
> return ((PayloadType)obj).value.equals(value);
> }
>
> public int hashCode() {
> return value.hashCode();
> }
>}
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>
>

-- 
 - Doug