[英]Spring Generated WSDL exposes wrong protocol (HTTP vs HTTPS) endpoint location
I have a Tomcat server running "behind" an Apache 2 (via mod_proxy), in the Tomcat there is a WAR serving Spring generated Webservices, which expose a service like this one: 我有一台运行在Apache 2后面的Tomcat服务器(通过mod_proxy),在Tomcat中有一个服务于Spring生成的Web服务的WAR,它公开了这样的服务:
<wsdl:service name="EcoboxPortService">
<wsdl:port binding="tns:EcoboxPortSoap11" name="EcoboxPortSoap11">
<soap:address location="http://host:80/ecobox-ws/Ecobox"/>
</wsdl:port>
</wsdl:service>
The problem is that the WSDL is actually obtained by the following URL: 问题是实际上通过以下URL获得了WSDL:
https://host/ecobox-ws/ecobox.wsdl (Please note it uses HTTPS)
Given the above 2 questions arise: 鉴于以上两个问题出现:
Similar question, but not entirely helpful: change the soap:address location in generated wsdl 类似的问题,但并非完全有帮助: 更改生成的wsdl中的soap:address位置
Relevant dependencies: 相关依赖项:
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
Relevant web.xml excerpt: 相关的web.xml摘录:
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
You need to tell the MessageDispatherServlet to transform the location: 您需要告诉MessageDispatherServlet转换位置:
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
Or if you use Java Config 或者,如果您使用Java Config
If you use the AbstractAnnotationConfigMessageDispatcherServletInitializer, enabling transformation is as simple as overriding the isTransformWsdlLocations() method to return true. 如果使用AbstractAnnotationConfigMessageDispatcherServletInitializer,则启用转换就像重写isTransformWsdlLocations()方法以返回true一样简单。
You might want to check your Tomcat configuration, where you'd need to set "proxyName" and "proxyPort". 您可能需要检查Tomcat配置,在其中需要设置“ proxyName”和“ proxyPort”。 JAX-WS auto-generation should pick it up from there / the request-headers. JAX-WS自动生成应该从那里/请求标头中拾取它。 More information here: http://tomcat.apache.org/tomcat-6.0-doc/proxy-howto.html 此处提供更多信息: http : //tomcat.apache.org/tomcat-6.0-doc/proxy-howto.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.