That'll work [not something i can do in COM though]. One thing to
think about, is that it looks like you're mixing types and
serialization info. This is one of my biggest gripes about ASP.NET
webservices where there's a 1..1 relationship between types and their
serialization representation. This appears to be going in the same
direction.
Cheers
Simon
On Thu, 21 Feb 2002 15:43:31 -0600, in soap you wrote:
>Talked to Glen and Tom on the chat, and they think that InternationalPrice
>should extend String.
>
>Example:
>
>class InternationalPrice extends String implements <HasAttributes> {
> String getCurrency()....
> ....
>}
>
>That way it can be treated like a String as necessary, and also has
>attributes.
>The <HasAttributes> interface is a yet unnamed marker interface.
>
>Comments ?
>
>
>Rich Scheuerle
>XML & Web Services Development
>512-838-5115 (IBM TL 678-5115)
>
>
>
>
> Simon Fell
>
> <[EMAIL PROTECTED] To: [EMAIL PROTECTED]
>
> co.uk> cc:
>
> Subject: Re: complexType extending a
>simpleType
> 02/21/2002 03:25
>
> PM
>
> Please respond to
>
> axis-dev
>
>
>
>
>
>
>
>
>FWIW, I ran into this doing the Group D doc/literal interop tests for
>pocketSOAP, and took exactly the same approach.
>
>Cheers
>Simon
>
>On Thu, 21 Feb 2002 15:12:03 -0600, in soap you wrote:
>
>>According to XML Schema Primer 0 Chapter 2.5.1, a complexType can be
>>derived from a simple type to add attribute information.
>>
>>
>>Lets say you had the following schema:
>>
>><complexType name="purchaseItem">
>> <complexContent>
>> <sequence>
>> <element name="itemName" type="xsd:string" />
>> <element name="price" type="xsd:string" />
>> </sequence>
>> </complexContent>
>></complexType>
>>
>>The above could be sent over the wire as:
>>
>><purchaseItem>
>> <itemName>
>> Widget
>> </item>
>> <price>
>> 1.00
>> </price>
>><purchaseItem>
>>
>>And the above would be modeled as a java bean named PurchaseItem with two
>>String properties.
>>
>>
>>Now let's say you extend this for an international market, thus the price
>>needs to know the
>>currency. Since it is closely tied to the price, you want to represent
>>currency as an
>>attribute on price. Here's how to represent this in xml schema.
>>
>><complexType name="internationalPrice">
>> <complexContent>
>> <simpleContent>
>> <extension base="xsd:string"/>
>> <attribute name="currency" type="xsd:string">
>> </extension>
>> </simpleContent>
>> <complexContent>
>></complexType>
>>
>><complexType name="purchaseItem">
>> <complexContent>
>> <sequence>
>> <element name="itemName" type="xsd:string" />
>> <element name="price" type="tns:internationalPrice" />
>> </sequence>
>> </complexContent>
>></complexType>
>>
>>So this means that price is an element whose value is a string and has a
>>currency attribute.
>>
>>Here is an example over the wire:
>>
>><purchaseItem>
>> <itemName>
>> Widget
>> </item>
>> <price currency="USDollars">
>> 1.00
>> </price>
>><purchaseItem>
>>
>>
>>We don't support extension of simpleTypes yet. When we do, we need
>>to generate a PurchaseItem bean (as before) and a InternationalPrice bean.
>>
>>However, note that the InternationalPrice has a "raw" value that is
>>serialized
>>directly...not within an element and not as an attribute value. The
>>serializer and deserializer need to know about this raw value, and the
>bean
>>requires
>>a special property name to get to the raw value. (I propose getValue and
>>setValue
>>accessors, which match what we do with enumeration classes...our other
>kind
>>of simpleType).
>>
>>So both emitters, bean serializer, and bean deserializer will need to have
>>extra code to support this feature. (Note that this is an optional
>JAX-RPC
>>feature).
>>
>>
>>Comments?
>>
>>
>>
>>
>>
>>
>>Rich Scheuerle
>>XML & Web Services Development
>>512-838-5115 (IBM TL 678-5115)
>
>
>