I'm not familiar too but I supposed the following definition is sufficiant:
COMMON.WSDL
<?xml version="1.0" encoding="UTF-8"?>
<definitions
targetNamespace="urn:common"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:common">
<types>
<xsd:schema>
<xsd:element name="UserIdentifier" type="tns:PhoneNumber,
tns:MailAddress"/>
<xsd:complexType name="PhoneNumber">
<xsd:attribute name="phoneNumber" type="xsd:string"
use="optional"/>
</xsd:complexType>
<xsd:complexType name="MailAddress">
<xsd:attribute name="phoneNumber" type="xsd:string"
use="optional"/>
</xsd:complexType>
</xsd:schema>
</types>
....
and FOOBAR.WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<definitions
targetNamespace="urn:foobar"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:typens="urn:foobar-type"
xmlns:common="urn:common"
xmlns:tns="urn:foobar">
<import
location="Common.wsdl"
namespace="urn:common">
</import>
<message name="sendRequest">
<part name="userId" type="common:UserIdentifier"/>
<part name="msg" type="xsd:string"/>
</message>
....
I did not succeed to find the bug. Many thanks for your precious help
gentleman,
Fabien.
-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Envoy� : lundi 17 mars 2003 18:36
� : [EMAIL PROTECTED]
Objet : Re: WSD2J: How to create a method(A a) where A is implemented
either by B or C ?
hi,
i'm not very familiar with XML Schema, but I think you need to specify a
targetnamespace
for PhoneNumber and MailAddress types.
mischa
Neulich, etwa am Montag, 17. M�rz 2003 16:49 meinten Fabien Guinet:
> Hello,
>
> The goal is to define a single method which could be interpreted
> differently on the server side depending on the object used (B or C).
> For example, I would like to define a type UserIdentifier which could be
> either a PhoneNumber or a MailAddress. I try to do this with the following
> types definition:
>
> <xsd:element name="UserIdentifier" type="PhoneNumber,
> MailAddress"/> <xsd:complexType name="PhoneNumber">
> <xsd:attribute name="PhoneNumber" type="xsd:string"
> use="optional"/>
> </xsd:complexType>
> <xsd:complexType name="MailAddress">
> <xsd:element name="MailAddress" type="xsd:string"/>
> </xsd:complexType>
>
> But when I'm creating my message with:
>
> <message name="sendRequest">
> <part name="userId" type="UserIdentifier"/>
> </message>
>
> And when I'm running WSDL2J, I get the following error:
>
> java.io.IOException: Type {urn:common}PhoneNumber is referenced but not
> defined.
> at
>
org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTable.
>j ava:496)
> ...
>
> Is there an error in my type definition ? Is this the good way to reach
the
> targeted behaviour ?
>
> In advance, many thanks for your help (because I'm a little bit lost :),
>
> Fabien