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

独自空忆成欢 提交于 2019-12-24 19:03:46

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/5747196/wsdl-schemalocation-is-it-possible-to-import-a-xsd-into-a-wsdl-using-a-relat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!