Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about WSDL import element

 
Apratim Khandalkar
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic