renamed ws sample to ws-outbound-gateway
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<!-- Appenders -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- Loggers -->
|
||||
<logger name="org.springframework">
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.ws">
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration">
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<logger name="org.springframework.integration.ws">
|
||||
<level value="warn" />
|
||||
</logger>
|
||||
|
||||
<!-- Root Logger -->
|
||||
<root>
|
||||
<priority value="warn" />
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
</log4j:configuration>
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.samples.ws;
|
||||
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.integration.channel.BeanFactoryChannelResolver;
|
||||
import org.springframework.integration.channel.ChannelResolver;
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.message.MessageBuilder;
|
||||
|
||||
/**
|
||||
* Demonstrates a web service invocation through a Web Service outbound Gateway.
|
||||
* A header-enricher provides the Soap Action prior to invocation. See the
|
||||
* 'temperatureConversion.xml' configuration file for more detail.
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
*/
|
||||
public class WebServiceDemo {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("temperatureConversion.xml", WebServiceDemo.class);
|
||||
ChannelResolver channelResolver = new BeanFactoryChannelResolver(context);
|
||||
|
||||
// Compose the XML message according to the server's schema
|
||||
String requestXml =
|
||||
"<FahrenheitToCelsius xmlns=\"http://tempuri.org/\">" +
|
||||
" <Fahrenheit>90.0</Fahrenheit>" +
|
||||
"</FahrenheitToCelsius>";
|
||||
|
||||
// Create the Message object
|
||||
Message<String> message = MessageBuilder.withPayload(requestXml).build();
|
||||
|
||||
// Send the Message to the handler's input channel
|
||||
MessageChannel channel = channelResolver.resolveChannelName("fahrenheitChannel");
|
||||
channel.send(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xmlns:stream="http://www.springframework.org/schema/integration/stream"
|
||||
xmlns:ws="http://www.springframework.org/schema/integration/ws"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/stream
|
||||
http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd
|
||||
http://www.springframework.org/schema/integration/ws
|
||||
http://www.springframework.org/schema/integration/ws/spring-integration-ws.xsd">
|
||||
|
||||
<!-- This chain receives from the 'fahrenheitChannel' and enriches the request Message by adding
|
||||
the "soap-action" header value. Then, the Web Service outbound Messaging Gateway invokes the
|
||||
Web Service for the given URI, and the reply Message is sent to the 'celsiusChannel'. -->
|
||||
<chain input-channel="fahrenheitChannel" output-channel="celsiusChannel">
|
||||
<ws:header-enricher>
|
||||
<ws:soap-action value="http://tempuri.org/FahrenheitToCelsius"/>
|
||||
</ws:header-enricher>
|
||||
<ws:outbound-gateway uri="http://www.w3schools.com/webservices/tempconvert.asmx"/>
|
||||
</chain>
|
||||
|
||||
<!-- The response from the service is logged to the console. -->
|
||||
<stream:stdout-channel-adapter id="celsiusChannel"/>
|
||||
|
||||
</beans:beans>
|
||||
Reference in New Issue
Block a user