繁体   English   中英

Spring Integration不公开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>

弹簧-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。 它在以下链接http://localhost:8080/hello-world/上显示html内容

但是不显示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 Integration WS端点位于Spring Web Services基础架构之上。

有关如何为您的Web服务公开WSDL的信息,请参见Spring Web Services文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM