我的代码如下。 我的请求将在GSOAP中提出,因此必须使用Axis2。 我可以将Axis2与弹簧集成一起使用
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>");
}
}
<?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>
<?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>
<?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>
答案 0 :(得分:0)
Spring Integration使用Spring WS,而不是AXIS2。
但是,您可以使用Messaging Gateway将消息发送到集成流,从而轻松集成AXIS2端点。