2 Replies Latest reply on Aug 26, 2005 5:12 AM by Anirban Basu

    Problem with custom data type holder

    Anirban Basu Newbie

      Using JBossWS (JBoss 4.0.2), wscompile-generated artefacts, I have a problem with using a custom data type holder. I have implemented the custom holder as follows.

      public final class WSStatusHolder implements javax.xml.rpc.holders.Holder {
       public WSStatus value;
      
       public WSStatusHolder() {
       }
      
       public WSStatusHolder(WSStatus value) {
       this.value = value;
       }
      
      }
      


      where WSStatus is a value type according to J2EE specifications - has a public zero-argument constructor, extends a class that is a value type having a zero-argument public constructor, public getter/setter methods for its fields, etc.

      Using a web service client (generated by JBossIDE from the corresponding WSDL), I am trying to access the webservice. The call invocation works fine but WSStatusHolder.value returns null even though I initialise it inside my stateless session bean such as
      statusHolder.value = new WSStatus(WSStatus.OK);


      Turning on Axis transport servlet log to debug level, I see that the response SOAP message contains something like
      <WSStatus_3 xsi:nil="1"/>
      where WSStatus_3 is a JAX-RPC mapping generated by the wscompile for WSStatus INOUT parameter (note that it is not mapped as WSStatusHolder).

      It seems to me that JBoss is failing to serialize/deserialize WSStatusHolder properly because if I create a new object in the client before the call such as
      WSStatusHolder holder = new WSStatusHolder(new WSStatus());
      which initialises the value field in the holder, then the serialization fails and the call fails saying that there is an unknown field WSStatus.

      I have tried using IntHolder in javax.xml.rpc.holders package instead of my custom WSStatusHolder and it works fine.

      What do you think is the problem?

        • 1. Re: Problem with custom data type holder
          Thomas Diesler Master

          Could you please create a JIRA issue and attach a sample deployment that allows us to reproduce what you are seeing. Idealy, the sample deployment is a webapp packaged as a war that will show the issue when we click on a link. The war should also contain the sources.

          • 2. Re: Problem with custom data type holder
            Anirban Basu Newbie

            Correct me if I am wrong. I don't see a J2EE spec violation for JAX-RPC accepted value types if my WSStatus class looks like this.

            public class WSStatus extends Status {
             public WSStatus() {}
             //...no other methods
            }
            

            where Status looks like
            public class Status implements Serializable {
             public static final int OK = 0;
             public static final int SYSTEMERR = -1;
             //and similar other constants
            
             private int type;
             private String fieldName;
             private String fieldValue;
            
             public Status() {}
             //...other constructors and accessor methods for the private fields
            }
            

            I thought such value classes can implement any interface except Remote. Funny enough, when I redeclared the WSStatus as
            public class WSStatus {
             private int type;
             private String fieldName;
             private String fieldValue;
            
             public WSStatus() {}
             //...other constructors and accessor methods for the private fields
            }
            

            and its RPC holder class as I mentioned before, it started working fine. Was I missing something?

            Thanks.