Spring 集成不公开 WSDL

Spring Integration not exposing WSDL

我是 Spring 集成的新手。创建简单的 POC 来向世界问好 代码如下

web.xml

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee     http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <description>ws:inbound-gateway sample</description>

    <servlet>
        <servlet-name>spring-ws</servlet-name>
        <servlet-    class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-    class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>WEB-INF/spring-ws-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

<servlet-mapping>
    <servlet-name>spring-ws</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>


<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>

spring-ws-config.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans.xsd">

    <import resource="classpath:/META-INF/spring/integration/inbound-    gateway-config.xml"/>

    <!-- Ensures that all incoming requests will be routed to the     ws:inbound-gateway -->
    <bean class="org.springframework.ws.server.endpoint.mapping.UriEndpointMapping">
        <property name="defaultEndpoint" ref="hello-world"/>
    </bean>

</beans>

入站网关-config.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-ws="http://www.springframework.org/schema/integration/ws"
xsi:schemaLocation="http://www.springframework.org/schema/integration/ws http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd
    http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <int:channel id="input"/>

    <int-ws:inbound-gateway id="hello-world" request-channel="input"/>

    <int:service-activator input-channel="input">
        <bean class="org.springframework.integration.samples.ws.HelloWorldWS">
            <property name="helloWorldBo" ref="HelloWorldBo" />
        </bean>
    </int:service-activator>

    <bean id="HelloWorldBo" class="org.springframework.integration.samples.bo.HelloWorldBoImpl" />
</beans>

HelloWorldBo.java

package org.springframework.integration.samples.bo;

import org.springframework.stereotype.Service;

@Service
public interface HelloWorldBo{


    String getHelloWorld(String str);

}

HelloWorldBoImpl.java

package org.springframework.integration.samples.bo;



public class HelloWorldBoImpl implements HelloWorldBo{

    public String getHelloWorld(String str){
        return "JAX-WS + Spring! " + str;
    }

}

HelloWorldWS.java

package org.springframework.integration.samples.ws;

import org.springframework.integration.samples.bo.HelloWorldBo;
import org.springframework.ws.server.endpoint.annotation.Endpoint;



@Endpoint
public class HelloWorldWS{


    HelloWorldBo helloWorldBo;


    public void setHelloWorldBo(HelloWorldBo helloWorldBo) {
        this.helloWorldBo = helloWorldBo;
    }

    public String getHelloWorld(String str) {

        return helloWorldBo.getHelloWorld(str);

    }

}

index.html

The web service has been successfully deployed.  You may now issue SOAP requests.

此程序正在运行但未公开 wsdl。 它显示 html 内容在以下 link http://localhost:8080/hello-world/

但不显示wsdl 我尝试了以下方法获取空白页

  1. http://localhost:8080/hello-world/hello
  2. http://localhost:8080/hello-world/hello.wsdl
  3. http://localhost:8080/hello-world/hello?wsdl

Spring 集成 WS 端点位于 Spring Web Services 基础设施之上。

请参阅 Spring Web Services 文档了解如何为您的 Web 服务公开 WSDL。