axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dies Koper <d...@jp.fujitsu.com>
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.

Regards,
Dies


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 (http://www.w3.org/TR/wsdl) site is:
> 
> <?xml version="1.0"?>
> <definitions name="StockQuote"
> 
> targetNamespace="http://example.com/stockquote/definitions"
>           xmlns:tns="http://example.com/stockquote/definitions"
>           xmlns:xsd1="http://example.com/stockquote/schemas"
>           xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>           xmlns="http://schemas.xmlsoap.org/wsdl/">
> 
>    <import namespace="http://example.com/stockquote/schemas"
>            location="http://example.com/stockquote/stockquote.xsd"/>
> 
>     <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
> http://www-128.ibm.com/developerworks/xml/library/ws-tip-imports.html):
> 
> <wsdl:types>
>     <xsd:schema targetNamespace="urn:listing2"
>                 xmlns:listing3="urn:listing3"
>                 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 
>       <xsd:import namespace="urn:listing3" schemaLocation="listing3.xsd"/>
> 
>       <xsd:import namespace="http://www.w3.org/2001/XMLSchema"/>
>       <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
> 
> 


Mime
View raw message