【问题标题】:Problem exposing SPRING-WS WSDL, can't reach it with the url暴露 SPRING-WS WSDL 的问题,无法通过 url 访问它
【发布时间】:2020-04-03 18:29:17
【问题描述】:

我正在尝试使用 Spring-WS 生成和公开带有 WSDL 的 SOAP 服务,但我遇到了一个问题,我启动服务器没有错误,但我无法通过他的 url 访问 wsdl。

为了精确起见,我正在 Tomcat 上部署 WAR 文件。

这是我的 web.xml,我在其中定义了我的 servlet

   <servlet>
      <description>Servlet pour l'exposition du webservices SOAP de purge</description>
      <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>
   <servlet-mapping>
      <servlet-name>spring-ws</servlet-name>
      <url-pattern>/ws/*</url-pattern>
   </servlet-mapping>

这就是我的 spring-ws-servlet.xml

里面的内容
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns = "http://www.springframework.org/schema/beans"
   xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context = "http://www.springframework.org/schema/context"
   xmlns:sws = "http://www.springframework.org/schema/web-services"
   xsi:schemaLocation = "http://www.springframework.org/schema/beans

   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
   http://www.springframework.org/schema/web-services
   http://www.springframework.org/schema/web-services/web-services-2.0.xsd
   http://www.springframework.org/schema/context 
   http://www.springframework.org/schema/context/spring-context-3.0.xsd">

   <context:component-scan base-package = "com.alm.*"/>
   <sws:annotation-driven/>

   <context:property-placeholder location="classpath:purge.properties" />

    <sws:dynamic-wsdl id = "purgev1"
      portTypeName = "purgev1Port"
      locationUri = "/ws/soap/purge/v1/" 
      <sws:xsd location = "classpath:xsd/purgev1.xsd"/>
   </sws:dynamic-wsdl>
</beans>

我猜如果 wsld 生成失败,我会收到一条错误消息,我检查了文件位置,一切都在正确的位置。

我正在尝试使用以下 URL 调用我的 wsdl:http://localhost:8080/mamba/ws/soap/purge/v1/purgev1.wsdl(mamba 是我的上下文路径)但我只收到 405 作为回报,并且在我的控制台中没有错误消息,无论何时我生成了wsdl,所以我有点迷茫。我搜索了文档和互联网上的许多帖子,但找不到解决方案。

我正在使用的版本:

  • Java 1.8
  • Tomcat 8.5.40
  • Maven 3.3.9
  • Spring-WS 3.0.7.RELEASE
  • 弹簧核心:5.2.2.RELEASE

如果您有任何想法,请告诉我。 感谢您为我所用的时间。

祝你有美好的一天!

【问题讨论】:

  • 期待一个帖子
  • @LevKuznetsov 我不能通过经典的 http get 访问 wsdl 吗?

标签: java spring jakarta-ee wsdl spring-ws


【解决方案1】:

您必须在 spring-ws-servlet.xml 中提及完整的 locationURI 值,例如 /mamba/ws/soap/purge/v1/purgev1.wsdl 通常 locationURI 参数将通过为主机名和端口添加前缀来公开您的 wsdl。

http://localhost:8080/mamba/ws/soap/purge/v1/purgev1.wsdl

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-11-21
    • 1970-01-01
    • 1970-01-01
    • 2017-01-03
    • 2019-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多