axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dies Koper <>
Subject Re: Question about importing XSD files
Date Fri, 13 Jan 2006 01:20:54 GMT
Hello Shelli,

The first example looks like the ones in the WSDL1.1 spec.
However, according to the WS-I spec it is wrong.
It says that you should not use wsdl:import to import xsd files. Use 
wsdl:import to import wsdl files, xsd:import to import xsd files.
The second example seems to correct this.

I think both would work fine with Axis. To prevent problems in the 
future, I'd go with the second example.

The file location is a URI. A URL is fine, but a relative path to the 
file is fine too.


Shelli D. Orton wrote:
> Hi All,
> My practical problem is this: I have been given a wsdl file and 2 xsd files
> to generate a client app against.  The wsdl does not import the xsd files,
> so I'm trying to fix it so that it does and I can run wsdl2java against it.
> So, I am trying to understand how to import schema files (.xsd) into a wsdl
> document.  I have found two examples on how to do this (actually more, but
> these were fairly clean examples).  
> The example from the w3 ( site is:
> <?xml version="1.0"?>
> <definitions name="StockQuote"
> targetNamespace=""
>           xmlns:tns=""
>           xmlns:xsd1=""
>           xmlns:soap=""
>           xmlns="">
>    <import namespace=""
>            location=""/>
>     <message name="GetLastTradePriceInput">
>         <part name="body" element="xsd1:TradePriceRequest"/>
>     </message>
>     <message name="GetLastTradePriceOutput">
>         <part name="body" element="xsd1:TradePrice"/>
>     </message>
>     <portType name="StockQuotePortType">
>         <operation name="GetLastTradePrice">
>            <input message="tns:GetLastTradePriceInput"/>
>            <output message="tns:GetLastTradePriceOutput"/>
>         </operation>
>     </portType>
> </definitions>
> Another example I found is (from
> <wsdl:types>
>     <xsd:schema targetNamespace="urn:listing2"
>                 xmlns:listing3="urn:listing3"
>                 xmlns:xsd="">
>       <xsd:import namespace="urn:listing3" schemaLocation="listing3.xsd"/>
>       <xsd:import namespace=""/>
>       <xsd:complexType name="Address">
>         <xsd:sequence>
>           <xsd:element name="streetNum" type="xsd:int"/>
>           <xsd:element name="streetName" type="xsd:string"/>
>           <xsd:element name="city" type="xsd:string"/>
>           <xsd:element name="state" type="xsd:string"/>
>           <xsd:element name="phone" type="listing3:Phone"/>
>         </xsd:sequence>
>       </xsd:complexType>
>     </xsd:schema>
>   </wsdl:types>
> In the first example, the xsd file is being imported in the definition
> section, and I'm assuming is available throughout the rest of the wsdl after
> that.  In the second, the xsd is being imported in a schema within the types
> section and is therefore only available in that schema.  Is this correct?
> I don't understand the significance/difference between the first example
> using "location" and the second using "schemaLocation".  I also don't
> understand how to reference the file's location.  Does it have to be made
> available on the internet as example 1 suggests, or is the xsd files
> co-located with wsdl good enough?
> Any help is greatly appreciated.
> Shelli

View raw message