You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Markus Zimmer <M_...@gmx.at> on 2012/07/25 11:28:07 UTC

[AXIS2] Problem with inheritance as return type

Hello,

I have a minor problem with one of my webservices which uses inheritance. Let me show you two classfiles (there are about 5 or 6 classes which extra attributes):


public abstract class WSTransferMessage {
  
  protected String type;
  protected String name;
  protected String id;
  protected String xmlMessage;
  
  
  public WSTransferMessage(String type, String name, String id, String xmlMessage)
  {
    this.type = type;
    this.name = name;
    this.id = id;
    this.xmlMessage = xmlMessage;
  }
  
  public String getType()
  {
    return type;
  }
  public String getName()
  {
    return name;
  }
  public String getID()
  {
    return id;
  }

  public String getXMLMessage()
  {
    return xmlMessage;
  }
}



public class WSTestCase extends WSTransferMessage{
  private boolean recordMovie;
  private boolean compressMovie;
  
  public WSTestCase(String type, String name, String id, String xmlMessage, boolean recordMovie, boolean compressMovie)
  {
    super(type,name,id,xmlMessage);
    this.recordMovie = recordMovie;
    this.compressMovie = compressMovie;
  }
  
  public boolean getRecordMovie()
  {
    return recordMovie;
  }
  public boolean getCompressMovie()
  {
    return compressMovie;
  }
}


I thought it would be ok to generate a soap method which will return an object of the type WSTransferMessage. Deserializing works (I've seen the correct information in the membrane SOAP monitor), but the following error appers when SOAP tries to serialize it:

org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://services.server/xsd}compressMovie
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at server.services.KLTASOAPListenerStub.fromOM(KLTASOAPListenerStub.java:10488)
    at server.services.KLTASOAPListenerStub.getNextCommand(KLTASOAPListenerStub.java:9556)
    at taconnector.java.WebserviceConnector.main(WebserviceConnector.java:33)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://services.server/xsd}compressMovie
    at server.services.KLTASOAPListenerStub$WSTransferMessage$Factory.parse(KLTASOAPListenerStub.java:51606)
    at server.services.KLTASOAPListenerStub$GetNextCommandResponse$Factory.parse(KLTASOAPListenerStub.java:40981)
    at server.services.KLTASOAPListenerStub.fromOM(KLTASOAPListenerStub.java:10300)
    ... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://services.server/xsd}compressMovie
    at server.services.KLTASOAPListenerStub$WSTransferMessage$Factory.parse(KLTASOAPListenerStub.java:51600)
    ... 4 more


This is my SOAP method:



public WSTransferMessage getNextCommand(String taConnectorId)
  {
    return controller.getNextCommand(taConnectorId);
  }



Is there any way to resolve my "unexpected subelement" problem without removing the whole inheritance? It would be great if i can keep it and SOAP will work correctly.

Thanks for your help.

Markus

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org