wood burning stoves*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Question about WSDL import element Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Question about WSDL import element" Watch "Question about WSDL import element" New topic
Author

Question about WSDL import element

Apratim Khandalkar
Ranch Hand

Joined: Jan 09, 2006
Posts: 34
Hi all I was reading notes on WSDL topic given on xyzws.com it gives following description about use of wsdl:import element



WSDL import element can only be used to import other WSDL files. For example:


INCORRECT:
<definitions name="StockQuote"
targetNamespace="http://example.com/stockquote/definitions"
xmlns:xsd1="http://example.com/stockquote/schemas""
...
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>
...
</definitions>

CORRECT:
<definitions name="StockQuote"
targetNamespace="http://example.com/stockquote/definitions">
<import namespace="http://example.com/stockquote/definitions"
location="http://example.com/stockquote/stockquote.wsdl"/>
<message name="GetLastTradePriceInput">
<part name="body" element="..."/>
</message>
...
</definitions>


Does this mean if I want to write separate file for schema definition and use this schema definition in WSDL then I need to write schema definition in another wsdl file and import this file .Why can't I directly import xsd file in WSDL.

Please help
Thanks in advance
Apratim
SCJP 1.5
SCEA Part I
Mission SCDJWS
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
Originally posted by Apratim Khandalkar:
Does this mean if I want to write separate file for schema definition and use this schema definition in WSDL then I need to write schema definition in another wsdl file and import this file .Why can't I directly import xsd file in WSDL.


You can import an XML Schema inside the XML Schema that resides inside the WSDL types section.

See WSDL file imports

Also make sure you understand the difference between XML Schema import and include. Import allows you to reference elements in the other namespace. Include adds the elements to your targetNamespace.
 
Don't get me started about those stupid light bulbs.
 
subject: Question about WSDL import element
 
Similar Threads
ws bb1.1: Explanation needed for examples
Question on import schemas
Is the example given in the thread a valid one as per the WSDL specificiation?
about import, which is correct?
ws bb1.1: Explanation needed for examples