Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
kevinliu
Product and Topic Expert
Product and Topic Expert
The problems




If you implement a web service tool, especially a wsdl processor, you may have already been deeply confused about how import works in WSDL. If you are a web service develpoer, you may have been puzzled by the WSDLs generated by your selected tool since they may be dispersed in different places and imported into a master file. In either case, It's not your fault. The culprit is WSDL1.1 spec which is underspecified and leaves a lot of ambiguities about how its import mechanism works, in
particularly:

    • When to use wsdl import vs when to use xsd import
    • How it works when a wsdl imports another wsdl which has imported schemas?
    • How it works when a wsdl imports another wsdl which has embedded schemas?
    • How it works when one embeded schema imports another embeded schema?


Based on clarifications provided by WS-I BP ()and current thinking in W3C WSDL2.0 work (), this note hopefully provides


answers to these common questions. It assumes you have a good knowledge of wsdl and xml schema.






When to use wsdl import vs. when to use xsd import?



WS-I BP1.0 provides a few guidance here. WSDL2.0 part 1 draft follows similar principle. Put it simple, use wsdl:import to import WSDL files and use xs:import to import xml schemas.




wsdl:import elements are defined as direct children of wsdl:definition, when appear in a wsdl, they MUST precede all other elements from the WSDL namespace exceptwsdl:documentation. wsdl:import can only be used to import other wsdl files. The wsdl:import must have a non-empty location attribute, but the location should only be used as a hint and processors are free to use other means to locate the imported wsdl file. The imported wsdl can be either in the same or different namespace as the importing wsdl file. however, namespace coersion is disallowed. In other words, the targetNamespace attribute on the
wsdl:definitions element of a description that is being imported MUST have same the value as the namespace attribute on the wsdl:import element in the importing DESCRIPTION.



xs:import can only be used inside xsd:schema elements under wsdl:types, and its use should follow the XML schmema spec (). When its namespace attribute is specified, it can only be used to import schemas in a different namespaces as the targetnamespace of the enclosing xs:schema element. If its namespace attribute is absent,  then the import allows unqualified reference to components with no target namespace.


http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html

http://www.w3.org/TR/wsdl20/

http://www.w3.org/TR/xmlschema-1/


1 Comment