我们可以将 Axis2 与 spring 集成使用吗

Can we use Axis2 with spring integration

我有如下代码。 我的请求将出现在 GSOAP 中,因此必须使用 Axis2。 我可以将 Axis2 与 spring 集成

一起使用吗

SimpleEchoResponder.java

package com.aswani.personal;


import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;

import org.springframework.integration.xml.source.DomSourceFactory;
/**
 * @author Chris Beams
 */
public class SimpleEchoResponder {

    public Source issueResponseFor(DOMSource request) {

        System.out.println("hi!!! ");
        System.out.println("We are inside echo service!!!");
        System.out.println("Request : "+request.getNode().getTextContent());
        return new DomSourceFactory().createSource(
                "<echoResponse xmlns=\"http://www.springframework.org/spring-    ws/samples/echo\">" +
                request.getNode().getTextContent() + "</echoResponse>");
    }
}

入站网关-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="ws-inbound-gateway" request-channel="input"/>

    <int:service-activator input-channel="input">
        <bean class="com.aswani.personal.SimpleEchoResponder"/>
    </int:service-activator>

</beans>

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"
    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.xsd 
    http://www.springframework.org/schema/web-services     http://www.springframework.org/schema/web-services/web-services-2.0.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="ws-inbound-gateway"/>

    </bean>

    <sws:dynamic-wsdl id="holiday" portTypeName="HumanResource" locationUri="http://localhost:8080/spring-integration-inbound-gateway-0.0.1-SNAPSHOT/echoservice/">
        <sws:xsd location="/WEB-INF/hr.xsd"/>
    </sws:dynamic-wsdl>


</beans>

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>
        <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>/echoservice</url-pattern>
</servlet-mapping>

<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 集成在幕后使用 Spring WS,而不是 AXIS2。

但是,您可以通过使用 Messaging Gateway.

将消息发送到集成流来轻松集成 AXIS2 端点