The AbstractWebServiceHandler is now an endpoint instead of a MessageHandler implementation. The <ws-handler/> element has been replaced with <ws-service-activator/>, and it is now a "standalone" component (i.e. it is no longer necessary to provide its id as a reference within another separate <service-activator/> element).

This commit is contained in:
Mark Fisher
2008-09-05 19:22:10 +00:00
parent b2db1c0b16
commit 9fc031e4f4
6 changed files with 54 additions and 47 deletions

View File

@@ -56,6 +56,12 @@ public class WebServiceHandlerParser extends AbstractSingleBeanDefinitionParser
throw new ConfigurationException("The 'uri' attribute is required.");
}
builder.addConstructorArgValue(uri);
String inputChannel = element.getAttribute("input-channel");
builder.addPropertyReference("source", inputChannel);
String outputChannel = element.getAttribute("output-channel");
if (StringUtils.hasText(outputChannel)) {
builder.addPropertyReference("outputChannel", outputChannel);
}
String marshallerRef = element.getAttribute("marshaller");
if (StringUtils.hasText(marshallerRef)) {
builder.addConstructorArgReference(marshallerRef);

View File

@@ -19,14 +19,16 @@
]]></xsd:documentation>
</xsd:annotation>
<xsd:element name="ws-handler">
<xsd:element name="ws-service-activator">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>
Defines a Web Service MessageHandler adapter.
Defines a Web Service based Service Activator endpoint.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="input-channel" type="xsd:string" use="required"/>
<xsd:attribute name="output-channel" type="xsd:string"/>
<xsd:attribute name="uri" type="xsd:string" use="required"/>
<xsd:attribute name="marshaller" type="xsd:string"/>
<xsd:attribute name="unmarshaller" type="xsd:string"/>

View File

@@ -19,6 +19,7 @@ package org.springframework.integration.ws.handler;
import java.io.IOException;
import java.net.URI;
import org.springframework.integration.endpoint.AbstractInOutEndpoint;
import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
@@ -36,7 +37,7 @@ import org.springframework.ws.soap.client.core.SoapActionCallback;
*
* @author Mark Fisher
*/
public abstract class AbstractWebServiceHandler implements MessageHandler {
public abstract class AbstractWebServiceHandler extends AbstractInOutEndpoint {
public static final String SOAP_ACTION_PROPERTY_KEY = "_ws.soapAction";
@@ -70,6 +71,7 @@ public abstract class AbstractWebServiceHandler implements MessageHandler {
return this.webServiceTemplate;
}
@Override
public final Message<?> handle(Message<?> message) {
Object responsePayload = this.doHandle(message.getPayload(), this.getRequestCallback(message));
return responsePayload != null ? new GenericMessage<Object>(responsePayload, message.getHeaders()) : null;

View File

@@ -1 +1 @@
ws-handler=org.springframework.integration.ws.config.WebServiceHandlerParser
ws-service-activator=org.springframework.integration.ws.config.WebServiceHandlerParser