简体   繁体   中英

WSDL schemaLocation : Is it possible to import a .xsd into a .wsdl using a relative path?

Here is my WSDL :

<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions targetNamespace="http://xxx" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns0="http://xxx/commun/axis" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://xxx" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

     <wsdl:types>
          <xsd:schema targetNamespace="http://xxx/commun/axis" xmlns="http://www.w3.org/2001/XMLSchema">
               <xsd:include schemaLocation="https://host:port/path/WebServices/wsdl/typesServicesApplicatifs.xsd"/>
(...)

The typesServicesApplicatifs.xsd file is in the same directory as the WSDL file (inside a war), is it possible tu use a relative path instead of an absolute path for the schema location ?

It would be really helpful, because for now, the schemaLocation is different on each environnment (the host and the port have to be specified).

EDIT : this question is the same as the last one in this thread (with no answer) : http://forum.springsource.org/showthread.php?p=342542

Here is a way to achieve this :

Using Spring-WS, the WSDL can be generated automatically from :

<sws:dynamic-wsdl id="holiday" portTypeName="HumanResource" **locationUri="/holidayService/"** targetNamespace="http://mycompany.com/hr/definitions">
  <sws:xsd location="/WEB-INF/hr.xsd"/>
</sws:dynamic-wsdl>

source : http://static.springsource.org/spring-ws/site/reference/html/tutorial.html#tutorial-publishing-wsdl

This way, the host, port and context path don't need to be specified inside the WSDL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM