SOAP Polymorphism unmarshalling problem


XML & Web services: SOAP Polymorphism unmarshalling problem

  1. SOAP Polymorphism unmarshalling problem (2 messages)

    I am having a problem in that a Polymorphic value passed in via SOAP (and returned) gets marshalled to it's base class, rather than to the specialized type.

    The SOAP XML snippet looks like:

    <parameters><type>Double</type><definitionId>1</definitionId><value xmlns:xsi="" xsi:type="ns2:doubleValue"><value>200.0</value></value></parameters>

    My problem is that I am getting a Value (the base class) instance in parameters.value instead of a DoubleValue.

    Now my understanding is that the xsi:type should have given the unmarshaler the information that it should unmarshal value to the child class DoubleValue, and not the parent Value.

    Just a note - this is slightly confusing as the value 200.0 will ultimately be stored in parameters.value.value and should be of type DoubleValue which extends Value.


    Threaded Messages (2)

  2. I realized the above may be a bit confusing, so I renamed the classes and attributes.

    A parameter has a parameterValue of type BaseValue.  However, I insert into parameterValue a DoubleValue which is a specialization of BaseValue.  DoubleValue adds a attribute theValue which contains the actual double value of 200.0 (in this example).  




  3. Example[ Go to top ]

    Sigh, the example XML got stripped somehow and I can't edit.  Let's try again:

    <parameters><type>Double</type><definitionId>1</definitionId><parameterValue xmlns:xsi="" xsi:type="ns2:doubleValue"><theValue>200.0</theValue></parameterValue></parameters>