Hello Dennis,
thanks for your answer! :)
I was trying to find a way to avoid modifying the schema file (as it is
extremely large). What I did as a test was the following, I changed this
(Vehicle being the abstract type of ElectricCar and Bicycle):
<xs:complexType name="CarPark">
<xs:choice maxOccurs ="unbounded">
<xs:element ref="t:Vehicle"/>
</xs:choice>
</xs:complexType>
to this:
<xs:complexType name="CarPark">
<xs:choice maxOccurs ="unbounded">
<xs:element name="Vehicle" type="t:VehicleType"/>
<xs:element name="ElectricCar" type="t:ElectricCarType" />
<xs:element name="Bicycle" type="t:BycicleType" />
</xs:choice>
</xs:complexType>
And after my changes I was able to set the specific types "ElectricCar" etc.
via stub methods, so I got what I wanted. But I don't know if that is what
you mean, however, I'll do a bit of research on your answer ;)
Greetings
Dennis
2009/5/28 Dennis Sosnoski <[email protected]>
> Hi Dennis,
>
> You can change your schema (assuming it's under your control) to use
> element substitution groups. With a substitution group, each element name
> can be tied to a specific extension of the base type.
>
> I realize that if you're not schema-knowledgeable this suggestion may not
> make much sense directly, but hopefully it gives you a starting point for
> searching. :-)
>
> - Dennis
>
> --
> Dennis M. Sosnoski
> SOA and Web Services in Java
> Axis2 Training and Consulting
> http://www.sosnoski.com - http://www.sosnoski.co.nz
> Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
>
>
>
>
> Dennis Korbar wrote:
>
>> Hello,
>>
>> I'm using axis2 for stub-generation on a webservice.
>> I was wondering if it is possible to turn off the use of xsi:type for the
>> type definition, to be a bit more specific consider the following example:
>>
>> Let's say I have a "vehicle" definition which is an abstract type, and
>> derived from this I have a car definition, now the generated stub will
>> produce a request like the following:
>>
>> <myRequest xmlns="myNamespace" xmlns:typ="anotherNamespace" xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance">
>> <sometag>
>> <typ:Vehicle xsi:type="typ:Car">
>> <typ:Engine xsi:type="typ:ElectricEngine"/>
>> </typ:Vehicle>
>> </sometag>
>> </myRequest>
>>
>> But what I want, is to have it look like this:
>>
>> <myRequest xmlns="myNamespace" xmlns:typ="anotherNamespace" xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance">
>> <sometag>
>> <typ:Car>
>> <typ:ElectricEngine/>
>> </typ:Car>
>> </sometag>
>> </myRequest>
>>
>> Is it possible to configure the stub generation to create requests the way
>> described above? Or is there some config parameter I can set?
>> I'm neither a xml or webservice expert, so I'm sorry if I'm confusing some
>> terms here, maybe I'm even posting on the wrong mailing list? (Maybe
>> xmlbeans mailing list will be more appropriate?) :-)
>>
>> Cheers,
>> Dennis
>>
>