0 Replies Latest reply on Mar 29, 2006 1:16 PM by restjohn

    Serialization of extraneous accessor value in response

    restjohn

      I am using JBoss 4.0.3.

      I have a wsdl generated by wscompile from a JSE. A value type returned
      as a respone from one of the operations includes an accessor method
      inherited from a parent class. Because the accessor has no
      complementary mutator, wscompile does not include a corresponding
      element in the schema type defined in the wsdl. This is the desired
      effect. However, when calling the operation from a client, there is
      derserialization error because the soap messge JBoss sends as the
      response includes the value returned by the inherited accessor.

      The java class definition of the response type looks like this:

      Class GenericResponse {
       public String getStatusMessage() {...}
       public void setStatusMessage(String statusMessage) {...}
       public String getRequestType() {return "REQUESTTYPE"}
      }
      
      Class ChildResponse extends GenericResponse {
       public String getChildAttribute() {...}
       public void setChildAttribute() {...}
      }


      The schema definition looks like this:

      <complexType name="ChildResponse">
       <sequence>
       <element name="statusMessage" type="string" />
       <element name="childAttribute" type="string" />
       </sequence>
      </complexType>


      This is ok because I want the statusMessage inherited from
      GenericResponse, but not requestType.

      When JBoss serializes an instance of ChildResponse, the message
      contains

      <ChildResponse>
       <statusMessage>...</statusMessage>
       <childAttribute>...</childAttribute>
       <requestType>...</requestType>
      </ChildResponse>


      Note the inclusion of the requestType element, which is not part of the
      schema type in the wsdl. This causes a deserialization error on the client
      side stating the requestType element is unexpected content. I had this
      same service deployed on the Sun JSAS with no problems. I can only
      assume that the underlying Axis code serializes objects dynamically by
      inspecting all the accessors of an instance without regard to whether the
      corresponding elements appear in the schema type. Is this assumption
      true and is there a work around or configuration option I can set to
      resolve this, or should I just change my code?

      Thanks for your help.

      Robert