[jboss-user] [JBossWS] - Problem with inheritance and JBossWS

fambad do-not-reply at jboss.com
Wed Jun 6 03:57:14 EDT 2007


I have a problem with the new JBossWS-1.2.1.GA in JBoss 4.2.0.GA and inheritance. 
To describe this problem first I have to describe my code structure:

For an example I have three classes (ClassA, ClassB and ClassC). ClassC inherits of ClassB and ClassB inherits of ClassA (ClassA --> ClassB --> ClassC). Now I have a webservice method that returns ClassB. In this method an instance of ClassC is being created and returned. This was not a problem in the former JBossWS version (and also in the other J2EE 4 styled webservices) but now in JBossWS 1.2 I only get returned an object of ClassB but I supposed to get an obejct of ClassC. 



  | public class ClassA {
  |   private String propA;
  | 
  |   // here setter and getter for propA
  | ......
  | }
  | 
  | public class ClassB extends ClassA {
  | 
  |   private String propB;
  |  // here setter and getter for propB
  | ......
  | }
  | 
  | public class ClassC extends ClassC {
  |   private String propC;
  |  // here setter and getter for propC
  | ......
  | }
  | 
  | @WebService
  | @SOAPBinding( style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED )
  | public class MyWebService {
  |  
  |  @WebMethod()
  |  public ClassB getClassB() {
  |    ClassC classC = new ClassC();
  |    classC.setPropA("propA");
  |    return classC;
  |  }
  | 
  |   /**
  |    * --> this method is only used to publish ClassC otherwise it is not known
  |    * in this webservice
  |    */
  |   @WebMethod()
  |   public ClassC getClassC() {
  |    ClassC classC = new ClassC();
  |    classC.setPropA("propA");
  |    return classC;
  |   }
  |   
  | }
  | 
  | }


Now I call getClassB() and the result that I got is an object of ClassB and not of ClassC.

What can I do to get an object of ClassC. I also looked at the returned SOAP message and there you can see that only informations about the ClassB instance are submitted. In JBoss 4.0.5 (JBossWS1.0.3) the SOAP message contains the type of the returned object and all data are being submitted correctly.

I also tried the SOAP parameter style BARE but nothing changed. And whenI use RPC/Literal then I get an error in the .NET Client that an instance of ClassB was expected but got an instance of ClassC. I also tried it with a JAVA client but there was the same occurance.

Any help would be appreciated!

Marco.

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

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



More information about the jboss-user mailing list