Dear all,
I am using Axis 1.0 to build something like a Proxy for our internal web
services.
There are a few services on our network which I have generated client stubs
for using
WSDL2Java. One service I import defines the following types:
<s:complexType name="Contact">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ContactID"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string"
/>
<s:element minOccurs="0" maxOccurs="1" name="TelephoneNumber"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CompanyName"
type="s:string" />
</s:sequence>
</s:complexType>
and
<s:complexType name="ContactDetail">
<s:complexContent mixed="false">
<s:extension base="s0:Contact">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Address1"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Address2"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="Address3"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="City"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="County"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="PostCode"
type="s:string" />
</s:sequence>
</s:extension>
</s:complexContent>
WSDL2Java imports this with no problem and creates 2 classes, Contact and
ContactDetail.
I then created my new service which re-exposes the service, using the
WSDL2Java generated
classes as return types. This works fine, but when I look at the .wsdl file
Java2WSDL generates
I see:
<complexType name="ContactDetail">
<complexContent>
<extension base="tns1:Contact">
<sequence />
</extension>
</complexContent>
</complexType>
(the definition for Contact is fine). If I remove Contact.getTypeDesc()
(note, from the base
class) then the wsdl is fine, but I have trouble deserialising
ContactDetails from the other web
service. I get the exception:
org.xml.sax.SAXException: Invalid element in foo.ContactDetail -
ContactID
and my ContactDetail objects only contain data corresponding to Contact
instances
(i.e. name, tel, contactId and companyname).
Does anyone know why this happens and how I might get around it? I don't
want to define a
new class/type just so that it doesn't have a getTypeDesc() definition in it
for use on the
server side just to get my wsdl to include the extra type info.
Any help gratefully received,
Myles