Hello, I'm writing a client of a web service WSDL that uses xsi:type[1],
which is a method of dynamically changing the type of element being used.
(I'm using Axis2 with ADB). The WSDL just asks for a RequestQuery, as
defined below:
<element name="MyRequestParameters">
<complexType>
<sequence>
<element name="RequestQuery" type="abc:RequestQuery"/>
</sequence>
</complexType>
</element>
where RequestQuery is:
<xs:complexType name="RequestQuery">
<xs:sequence>
<xs:element name="reqVal" type="xsd:string">
</xs:sequence>
</xs:complexType>
But request query has a derived type that I need to use, say
FinancialRequestQuery:
<xs:complexType name="FinancialRequestQuery">
<xs:complexContent>
<xs:extension base="abc:RequestQuery">
<xs:sequence>
<xs:element name="finanReqVal"
type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
Over the wire, however, instead of sending a FinancialRequestQuery I have to
use a RequestQuery with xsi:type as follows:
<RequestQuery xsi:type="abc:FinancialRequestQuery">
<reqVal>hello</reqVal>
<abc:finanReqVal>how are you</abc:finanReqVal>
</RequestQuery>
ADB binding does not provide me the necessary setters for this though--I'm
provided a method to set reqVal (because it's normally part of Request) but
not finanReqVal (because it's only allowed here because of the xsi:type
changing it to the derived FinancialRequestQuery type.)
What I guess I need to do is, (1) given an ADB generated object such as
RequestQuery, to manually construct an xsi:type attribute and add it to that
element; and (2) to manually construct an <abc:finanReqVal> child element
and add it to the ADB RequestQuery object. Does anyone have quick code
snippets on how to do that? (Other ideas or suggestions for working with
xsi:type also welcome.)
Thanks,
Glen
[1] http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_over_st1.html
--
View this message in context:
http://www.nabble.com/Need-help-working-with-xsi%3Atype-and-ADB-tp23853502p23853502.html
Sent from the Axis - User mailing list archive at Nabble.com.