Hi Dimuthu,

I'll definitely take a look at that; the if blocks sound like a good idea!

Cheers,
Sérgio

---
On Thu, May 29, 2008 at 12:14 PM, Dimuthu Gamage <[EMAIL PROTECTED]> wrote:
> On Thu, May 29, 2008 at 3:39 PM, Sérgio Gomes <[EMAIL PROTECTED]> wrote:
>> Hi everyone,
>>
>> I'm developing a patch against the ADB C code generator to allow it to
>> handle polymorphism correctly. Let me illustrate my point.
>
> nice to hear you are going through with it:)
>>
>> Say you have a complexType A, which is abstract. Then there are
>> complexTypes A1 and A2, which extend A and are not abstract.
>>
>> Now, polymorphism can exist in two forms, from the client's perspective:
>>  - A parameter in a SOAP method can be of abstract type A; this means
>> that you can provide the method with either an A1 or A2 object (not A,
>> because it's abstract).
>>  - A return value for a SOAP method can be of abstract type A; this
>> means that the server will either return an A1 or an A2 (once again,
>> not A, because it's abstract).
>>
>> The first case is relatively easy to handle, and I've already
>> implemented the solution for it. All that is required is for each
>> structure to have a pointer to its own serialization method, so that
>> even if you cast it to A the right serialization will be performed.
>>
>> The second case, however, is quite problematic. The only way to know
>> which type is being returned is, of course, during runtime, by looking
>> at the xsi:type property. This is relatively easy to do with Axiom,
>> but the problem is how to invoke the right create method, but the
>> problem is that for this to work correctly, it's necessary to invoke
>> the "create" and "deserialize" methods for the right subtype (the ones
>> for A won't do, as they aren't aware of the specific properties of A1
>> and A2). I thought of creating one global hash table with the
>> create/deserialize methods for all types when generating the stub for
>> the service, but it doesn't strike me as a particularly elegant
>> solution. Does anyone have any other suggestions?
>
> In java, there is a class generated called 'ExtensionMapper' which has
> all the mapping. We can use similar thing to return create and
> deserialize function pointers (may be serialize function pointer as
> well). There you can hard code the mapping inside multiple if  blocks,
> rather than using a hash map.
>
> Thanks
> Dimuthu
>
>
>>
>> It's at times like these I wish C had classes and I could just let the
>> language handle the issue itself ;-)
>>
>> Cheers,
>> Sérgio
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to