Unable to create an instance of abtract class (called from web services)

Hello,
I generated the java code from wsdl. The generated abtract class is as below
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NABC", propOrder = {
    "rType"
})
@XmlSeeAlso({
    D_NABC.class,
    B_NABC.class
})
public abstract class NABC {

    @XmlElement(nillable = true)
    protected RType rType;
    @XmlAttribute(required = true)
    protected String format;
/**
     * Gets the value of the rType property.
     *
     * @return
     *     possible object is
     *     {@link RType }
     *    
     */
    public RType getRType() {
        return rType;
    }

    /**
     * Sets the value of the rType property.
     *
     * @param value
     *     allowed object is
     *     {@link RType }
     *    
     */
    public void setRType(RType value) {
        this.rType = value;
    }

    /**
     * Gets the value of the format property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *    
     */
    public String getFormat() {
        return format;
    }

    /**
     * Sets the value of the format property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *    
     */
    public void setFormat(String value) {
        this.format = value;
    }
}

The webservice has a method
 @WebMethod
  @WebResult(targetNamespace="")
  @RequestWrapper(localName="create", targetNamespace="http://abcde.services.com/", className="com.abcde.Create")
  @ResponseWrapper(localName="createResponse", targetNamespace="http://abcde.services.com/", className="com.abcde.CreateResponse")
  public abstract ABC create(@WebParam(name="nabc", targetNamespace="") NABC n_abc)
    throws SerializableException;

I created a subclass of NABC as below:
public class Sub_NABC extends NABC {
    String path;
    public Sub_NABC() {
         super();
    }

    public String getPath() {return path;}
    public String setPath(String path) {this.path = path;}
}

---
When I call the create method by passing Sub_NABC, I got the message error
[javax.xml.bind.UnmarshalException: Unable to create an instance of NABC
-> we can not pass Sub_NABC to the web service method? Is there any way to do it?
Please help.
Thank you very much.
ndhaiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sciuriwareConnect With a Mentor Commented:
By definition you can not instantiate an abstract class.
It is a building block that becomes usable by extending it and defining its abstract members.
So, create your own class derived from the abstract class and fill in the gaps first.

;JOOP!
0
 
sciuriwareCommented:
Example from the JAVADOC:   java.util.AbstractSet
which is the root of a.o. the HashSet and TreeSet classes.

;JOOP!
0
All Courses

From novice to tech pro — start learning today.