简体   繁体   English

暴露 SPRING-WS WSDL 的问题,无法通过 url 访问它

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

I'm trying to generate and expose SOAP service with a WSDL using Spring-WS but I'm facing a problem, I get no error starting the server but I cannot reach the wsdl with his url.我正在尝试使用 Spring-WS 使用 WSDL 生成和公开 SOAP 服务,但我遇到了一个问题,我在启动服务器时没有出现错误,但我无法使用他的 url 访问 wsdl。

I'm deploying a WAR File on a Tomcat just to precise.我正在 Tomcat 上部署一个 WAR 文件,只是为了精确。

So this is my web.xml where I define my servlet所以这是我的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>

And this is what's inside my spring-ws-servlet.xml这就是我的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>

I guess if the wsld generation was failing I would get an error message and I checked the file location, everything is in the correct place.我想如果 wsld 生成失败,我会收到一条错误消息,我检查了文件位置,一切都在正确的位置。

I'm trying to call my wsdl with this URL : http://localhost:8080/mamba/ws/soap/purge/v1/purgev1.wsdl (mamba is my context path) but I get only a 405 in return and no error message in my console, neither when I generate the wsdl so I'm a bit lost.我试图用这个 URL 调用我的 wsdl: http://localhost:8080/mamba/ws/soap/purge/v1/purgev1.wsdl (mamba 是我的上下文路径)但我只得到 405 作为回报,没有我的控制台中的错误消息,当我生成 wsdl 时都没有,所以我有点迷茫。 I searched on the documentation and on many posts on the Internet but cannot find the solution.我搜索了文档和互联网上的许多帖子,但找不到解决方案。

Versions i'm using :我正在使用的版本:

  • Java 1.8爪哇 1.8
  • Tomcat 8.5.40雄猫 8.5.40
  • Maven 3.3.9 Maven 3.3.9
  • Spring-WS 3.0.7.RELEASE Spring-WS 3.0.7.RELEASE
  • Spring-core : 5.2.2.RELEASE弹簧核心:5.2.2.RELEASE

If you have any idea, let me know.如果您有任何想法,请告诉我。 I thank you for the time you used for me.我感谢你为我所用的时间。

Have a great day !祝你有美好的一天 !

you have to mention the complete locationURI value in spring-ws-servlet.xml like /mamba/ws/soap/purge/v1/purgev1.wsdl generally locationURI parameter will expose your wsdl by prefixing hostname and port.您必须在 spring-ws-servlet.xml 中提及完整的 locationURI 值,例如/mamba/ws/soap/purge/v1/purgev1.wsdl通常 locationURI 参数将通过添加主机名和端口前缀来公开您的 wsdl。

http://localhost:8080/mamba/ws/soap/purge/v1/purgev1.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