簡體   English   中英

暴露 SPRING-WS WSDL 的問題,無法通過 url 訪問它

[英]Problem exposing SPRING-WS WSDL, can't reach it with the url

我正在嘗試使用 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 時都沒有,所以我有點迷茫。 我搜索了文檔和互聯網上的許多帖子,但找不到解決方案。

我正在使用的版本:

  • 爪哇 1.8
  • 雄貓 8.5.40
  • Maven 3.3.9
  • Spring-WS 3.0.7.RELEASE
  • 彈簧核心:5.2.2.RELEASE

如果您有任何想法,請告訴我。 我感謝你為我所用的時間。

祝你有美好的一天 !

您必須在 spring-ws-servlet.xml 中提及完整的 locationURI 值,例如/mamba/ws/soap/purge/v1/purgev1.wsdl通常 locationURI 參數將通過添加主機名和端口前綴來公開您的 wsdl。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM