You can import the schema into your XSD or WSDL file:
<xsd:import namespace="schema-targetnamespace-uri" location="schema-url"/>
Note that when importing an XSD into WSDL, you must import it within a
<schema> section within the <types> section, and you must use <xsd:import>
rather than <wsdl:import>. You also must declare the imported namespace.
e.g.,
<wsdl:definitions name="this-wsdl" targetNamespace="this-wsdl-ns"
xmlns:wsdl="wsdl-ns"
xmlns:soap="wsdl-soap-ns"
xmlns:xsd="schema-ns"
xmlns:intf="this-wsdl-ns"
xmlns:import="imported-schema-ns">
<wsdl:types>
<xsd:schema targetNamespace="this-wsdl-ns">
<xsd:import namespace="imported-schema-ns" location="xsd-file-url"/>
</xsd:schema>
</wsdl:types>
</wsdl:definitions>
Anne
-----Original Message-----
From: Elliot Metsger [mailto:[EMAIL PROTECTED]
Sent: Monday, August 09, 2004 8:56 AM
To: [EMAIL PROTECTED]
Subject: Re-use an external XSD in Types writeSchema( ) method
All,
I have a webservice that requires custom types, so I've written
(de)serializers for them. I'm using Axis 1.1 on the latest Tomcat 5.
I have an external XSD that defines the data types, and I'd like to use
elements of the XSD to generate the schema used in the writeSchema( )
method.
I've met with no success, and ended up building the schema from scratch
inside the writeSchema method which seems not good:
I created a DOM tree from my external XSD and extracted the relevent
<complexType> element into a Node object. I then tried different ways
to get the Types object to import it (via DOM's importNode( ) method)
and was unsuccessful. I ended up building the XSD from scratch using
the Types createElement( ) method.
Is there a way I can use external XSD and place content from it into my
WSDL types? I don't want to have to maintain my datatypes in multiple
places if possible. Am I missing something?
Thanks for any help!
Elliot Metsger
[EMAIL PROTECTED]