Updated the names of the projects

This commit is contained in:
Ben Hale
2008-05-20 21:41:01 +00:00
parent 37f8d925c8
commit 6696064dd0
531 changed files with 48 additions and 48 deletions

View File

@@ -0,0 +1 @@
ws-target=org.springframework.integration.ws.config.WebServiceTargetAdapterParser

View File

@@ -0,0 +1 @@
http\://www.springframework.org/schema/integration/spring-integration-ws-1.0.xsd=org/springframework/integration/ws/config/spring-integration-ws-1.0.xsd

View File

@@ -0,0 +1,101 @@
/*
* Copyright 2002-2008 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.ws.adapter;
import java.io.IOException;
import java.net.URI;
import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
import org.springframework.util.Assert;
import org.springframework.ws.WebServiceMessage;
import org.springframework.ws.WebServiceMessageFactory;
import org.springframework.ws.client.core.FaultMessageResolver;
import org.springframework.ws.client.core.WebServiceMessageCallback;
import org.springframework.ws.client.core.WebServiceTemplate;
import org.springframework.ws.soap.SoapMessage;
import org.springframework.ws.soap.client.core.SoapActionCallback;
/**
* Base class for Web Service target channel adapters.
*
* @author Mark Fisher
*/
public abstract class AbstractWebServiceTargetAdapter implements MessageHandler {
public static final String SOAP_ACTION_PROPERTY_KEY = "_ws.soapAction";
private final WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
private volatile WebServiceMessageCallback requestCallback;
public AbstractWebServiceTargetAdapter(URI uri) {
Assert.notNull(uri, "'uri' must not be null");
this.webServiceTemplate.setDefaultUri(uri.toString());
}
public void setMessageFactory(WebServiceMessageFactory messageFactory) {
this.webServiceTemplate.setMessageFactory(messageFactory);
}
public void setRequestCallback(WebServiceMessageCallback requestCallback) {
this.requestCallback = requestCallback;
}
public void setFaultMessageResolver(FaultMessageResolver faultMessageResolver) {
this.webServiceTemplate.setFaultMessageResolver(faultMessageResolver);
}
protected WebServiceTemplate getWebServiceTemplate() {
return this.webServiceTemplate;
}
public final Message<?> handle(Message<?> message) {
Object responsePayload = this.doHandle(message.getPayload(), this.getRequestCallback(message));
return (responsePayload != null ? new GenericMessage<Object>(responsePayload, message.getHeader()) : null);
}
protected abstract Object doHandle(Object requestPayload, WebServiceMessageCallback requestCallback);
private WebServiceMessageCallback getRequestCallback(Message<?> requestMessage) {
if (this.requestCallback != null) {
return this.requestCallback;
}
String soapAction = requestMessage.getHeader().getProperty(SOAP_ACTION_PROPERTY_KEY);
return (soapAction != null) ? new TypeCheckingSoapActionCallback(soapAction) : null;
}
private static class TypeCheckingSoapActionCallback extends SoapActionCallback {
TypeCheckingSoapActionCallback(String soapAction) {
super(soapAction);
}
@Override
public void doWithMessage(WebServiceMessage message) throws IOException {
if (message instanceof SoapMessage) {
super.doWithMessage(message);
}
}
}
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright 2002-2008 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.ws.adapter;
import java.net.URI;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.util.Assert;
import org.springframework.ws.client.core.WebServiceMessageCallback;
/**
* A marshalling Web Service target channel adapter.
*
* @author Mark Fisher
* @see Marshaller
* @see Unmarshaller
*/
public class MarshallingWebServiceTargetAdapter extends AbstractWebServiceTargetAdapter {
public MarshallingWebServiceTargetAdapter(URI uri, Marshaller marshaller, Unmarshaller unmarshaller) {
super(uri);
Assert.notNull(marshaller, "marshaller must not be null");
Assert.notNull(unmarshaller, "unmarshaller must not be null");
this.getWebServiceTemplate().setMarshaller(marshaller);
this.getWebServiceTemplate().setUnmarshaller(unmarshaller);
}
public MarshallingWebServiceTargetAdapter(URI uri, Marshaller marshaller) {
super(uri);
Assert.notNull(marshaller, "marshaller must not be null");
Assert.isInstanceOf(Unmarshaller.class, marshaller,
"Marshaller [" + marshaller + "] does not implement the Unmarshaller interface. " +
"Please set an Unmarshaller explicitly by using the " + this.getClass().getName() +
"(String uri, Marshaller marshaller, Unmarshaller unmarshaller) constructor.");
this.getWebServiceTemplate().setMarshaller(marshaller);
this.getWebServiceTemplate().setUnmarshaller((Unmarshaller) marshaller);
}
@Override
protected Object doHandle(Object requestPayload, WebServiceMessageCallback requestCallback) {
return this.getWebServiceTemplate().marshalSendAndReceive(requestPayload, requestCallback);
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright 2002-2008 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.ws.adapter;
import java.io.IOException;
import java.net.URI;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource;
import org.springframework.integration.message.MessagingException;
import org.springframework.ws.client.core.SourceExtractor;
import org.springframework.ws.client.core.WebServiceMessageCallback;
import org.springframework.xml.transform.StringResult;
import org.springframework.xml.transform.StringSource;
import org.springframework.xml.transform.TransformerObjectSupport;
/**
* A target channel adapter for calling out to a Web Service.
*
* @author Mark Fisher
*/
public class SimpleWebServiceTargetAdapter extends AbstractWebServiceTargetAdapter {
private final SourceExtractor sourceExtractor;
public SimpleWebServiceTargetAdapter(URI uri) {
this(uri, null);
}
public SimpleWebServiceTargetAdapter(URI uri, SourceExtractor sourceExtractor) {
super(uri);
this.sourceExtractor = (sourceExtractor != null) ? sourceExtractor : new DefaultSourceExtractor();
}
@Override
protected Object doHandle(Object requestPayload, WebServiceMessageCallback requestCallback) {
if (requestPayload instanceof Source) {
return this.getWebServiceTemplate().sendSourceAndReceive(
(Source) requestPayload, requestCallback, this.sourceExtractor);
}
if (requestPayload instanceof String) {
StringResult result = new StringResult();
this.getWebServiceTemplate().sendSourceAndReceiveToResult(
new StringSource((String) requestPayload), requestCallback, result);
return result.toString();
}
throw new MessagingException("Unsupported payload type '" + requestPayload.getClass() +
"'. " + this.getClass().getName() + " only supports 'java.lang.String' and '" + Source.class.getName() +
"'. Consider using the '" + MarshallingWebServiceTargetAdapter.class.getName() + "' instead.");
}
private static class DefaultSourceExtractor extends TransformerObjectSupport implements SourceExtractor {
public Object extractData(Source source) throws IOException, TransformerException {
if (source instanceof DOMSource) {
return source;
}
DOMResult result = new DOMResult();
this.transform(source, result);
return new DOMSource(result.getNode());
}
}
}

View File

@@ -0,0 +1,94 @@
/*
* Copyright 2002-2008 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.ws.config;
import org.w3c.dom.Element;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.endpoint.HandlerEndpoint;
import org.springframework.integration.scheduling.Subscription;
import org.springframework.integration.ws.adapter.MarshallingWebServiceTargetAdapter;
import org.springframework.integration.ws.adapter.SimpleWebServiceTargetAdapter;
import org.springframework.util.StringUtils;
/**
* Parser for the &lt;ws-target/&gt; element.
*
* @author Mark Fisher
*/
public class WebServiceTargetAdapterParser extends AbstractSingleBeanDefinitionParser {
protected Class<?> getBeanClass(Element element) {
return HandlerEndpoint.class;
}
protected boolean shouldGenerateId() {
return false;
}
protected boolean shouldGenerateIdAsFallback() {
return true;
}
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
String channel = element.getAttribute("channel");
String uri = element.getAttribute("uri");
if (!StringUtils.hasText(channel)) {
throw new ConfigurationException("The 'channel' attribute is required.");
}
if (!StringUtils.hasText(uri)) {
throw new ConfigurationException("The 'uri' attribute is required.");
}
String marshallerRef = element.getAttribute("marshaller");
String unmarshallerRef = element.getAttribute("unmarshaller");
String sourceExtractorRef = element.getAttribute("source-extractor");
RootBeanDefinition adapterDef = (StringUtils.hasText(marshallerRef)) ?
this.parseMarshallingAdapter(uri, marshallerRef, unmarshallerRef) :
this.parseSimpleAdapter(uri, sourceExtractorRef);
String adapterBeanName = parserContext.getReaderContext().generateBeanName(adapterDef);
parserContext.registerBeanComponent(new BeanComponentDefinition(adapterDef, adapterBeanName));
builder.addConstructorArgReference(adapterBeanName);
Subscription subscription = new Subscription(channel);
builder.addPropertyValue("subscription", subscription);
}
private RootBeanDefinition parseMarshallingAdapter(String uri, String marshallerRef, String unmarshallerRef) {
RootBeanDefinition beanDefinition = new RootBeanDefinition(MarshallingWebServiceTargetAdapter.class);
beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(uri);
beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(marshallerRef));
if (StringUtils.hasText(unmarshallerRef)) {
beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(unmarshallerRef));
}
return beanDefinition;
}
private RootBeanDefinition parseSimpleAdapter(String uri, String sourceExtrractorRef) {
RootBeanDefinition beanDefinition = new RootBeanDefinition(SimpleWebServiceTargetAdapter.class);
beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(uri);
if (StringUtils.hasText(sourceExtrractorRef)) {
beanDefinition.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(sourceExtrractorRef));
}
return beanDefinition;
}
}

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.springframework.org/schema/integration"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:tool="http://www.springframework.org/schema/tool"
targetNamespace="http://www.springframework.org/schema/integration"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:include schemaLocation="http://www.springframework.org/schema/integration/spring-integration-core-1.0.xsd"/>
<xsd:include schemaLocation="http://www.springframework.org/schema/integration/spring-integration-adapters-1.0.xsd"/>
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
<xsd:import namespace="http://www.springframework.org/schema/tool"/>
<xsd:annotation>
<xsd:documentation><![CDATA[
Defines the configuration elements for Spring Integration's Web Service adapters.
]]></xsd:documentation>
</xsd:annotation>
<xsd:element name="ws-target">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>
Defines a Web Service target channel adapter.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="uri" type="xsd:string" use="required"/>
<xsd:attribute name="channel" type="xsd:string" use="required"/>
<xsd:attribute name="marshaller" type="xsd:string"/>
<xsd:attribute name="unmarshaller" type="xsd:string"/>
<xsd:attribute name="source-extractor" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>

View File

@@ -0,0 +1,31 @@
Import-Package: javax.xml.transform;resolution:=optional,javax.xml.tra
nsform.dom;resolution:=optional,org.springframework.beans.factory.con
fig;resolution:=optional,org.springframework.beans.factory.parsing;re
solution:=optional,org.springframework.beans.factory.support;resoluti
on:=optional,org.springframework.beans.factory.xml;resolution:=option
al,org.springframework.integration;resolution:=optional,org.springfra
mework.integration.endpoint;resolution:=optional,org.springframework.
integration.handler;resolution:=optional,org.springframework.integrat
ion.message;resolution:=optional,org.springframework.integration.sche
duling;resolution:=optional,org.springframework.integration.ws.adapte
r;resolution:=optional,org.springframework.integration.ws.config;reso
lution:=optional,org.springframework.oxm;resolution:=optional,org.spr
ingframework.util;resolution:=optional,org.springframework.ws;resolut
ion:=optional,org.springframework.ws.client.core;resolution:=optional
,org.springframework.ws.soap;resolution:=optional,org.springframework
.ws.soap.client.core;resolution:=optional,org.springframework.xml.tra
nsform;resolution:=optional,org.w3c.dom;resolution:=optional
Export-Package: org.springframework.integration.ws.adapter;uses:="org.
springframework.ws.client.core,org.springframework.integration.handle
r,org.springframework.ws.soap.client.core,org.w3c.dom,org.springframe
work.oxm,javax.xml.transform,javax.xml.transform.dom,org.springframew
ork.ws,org.springframework.ws.soap,org.springframework.util,org.sprin
gframework.xml.transform,org.springframework.integration.message",org
.springframework.integration.ws.config;uses:="org.springframework.bea
ns.factory.support,org.springframework.integration.endpoint,org.sprin
gframework.beans.factory.config,org.springframework.beans.factory.xml
,org.springframework.integration,org.springframework.beans.factory.pa
rsing,org.w3c.dom,org.springframework.integration.scheduling,org.spri
ngframework.integration.ws.adapter,org.springframework.util"
Bundle-Name: Spring Integration Web Services Support

View File

@@ -0,0 +1,38 @@
/*
* Copyright 2002-2008 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.ws.config;
import java.io.IOException;
import javax.xml.transform.Result;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.XmlMappingException;
/**
* @author Mark Fisher
*/
public class StubMarshaller implements Marshaller {
public boolean supports(Class clazz) {
return false;
}
public void marshal(Object graph, Result result) throws XmlMappingException, IOException {
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright 2002-2008 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.ws.config;
import java.io.IOException;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.oxm.XmlMappingException;
/**
* @author Mark Fisher
*/
public class StubMarshallerAndUnmarshaller implements Marshaller, Unmarshaller {
public boolean supports(Class clazz) {
return false;
}
public void marshal(Object graph, Result result) throws XmlMappingException, IOException {
}
public Object unmarshal(Source source) throws XmlMappingException, IOException {
return null;
}
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2002-2008 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.ws.config;
import java.io.IOException;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import org.springframework.ws.client.core.SourceExtractor;
/**
* @author Mark Fisher
*/
public class StubSourceExtractor implements SourceExtractor {
public Object extractData(Source source) throws IOException, TransformerException {
return "test";
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright 2002-2008 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.ws.config;
import java.io.IOException;
import javax.xml.transform.Source;
import org.springframework.oxm.Unmarshaller;
import org.springframework.oxm.XmlMappingException;
/**
* @author Mark Fisher
*/
public class StubUnmarshaller implements Unmarshaller {
public boolean supports(Class clazz) {
return false;
}
public Object unmarshal(Source source) throws XmlMappingException, IOException {
return null;
}
}

View File

@@ -0,0 +1,92 @@
/*
* Copyright 2002-2008 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.ws.config;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.endpoint.HandlerEndpoint;
import org.springframework.integration.ws.adapter.MarshallingWebServiceTargetAdapter;
import org.springframework.integration.ws.adapter.SimpleWebServiceTargetAdapter;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.Unmarshaller;
import org.springframework.ws.client.core.SourceExtractor;
/**
* @author Mark Fisher
*/
public class WebServiceTargetAdapterParserTests {
@Test
public void testSimpleWebServiceTargetAdapterWithDefaultSourceExtractor() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"simpleWebServiceTargetAdapterParserTests.xml", this.getClass());
HandlerEndpoint endpoint =
(HandlerEndpoint) context.getBean("adapterWithDefaultSourceExtractor");
assertEquals(SimpleWebServiceTargetAdapter.class, endpoint.getHandler().getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(endpoint.getHandler());
assertEquals("DefaultSourceExtractor", accessor.getPropertyValue("sourceExtractor").getClass().getSimpleName());
}
@Test
public void testSimpleWebServiceTargetAdapterWithCustomSourceExtractor() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"simpleWebServiceTargetAdapterParserTests.xml", this.getClass());
HandlerEndpoint endpoint =
(HandlerEndpoint) context.getBean("adapterWithCustomSourceExtractor");
assertEquals(SimpleWebServiceTargetAdapter.class, endpoint.getHandler().getClass());
DirectFieldAccessor accessor = new DirectFieldAccessor(endpoint.getHandler());
SourceExtractor sourceExtractor = (SourceExtractor) context.getBean("sourceExtractor");
assertEquals(sourceExtractor, accessor.getPropertyValue("sourceExtractor"));
}
@Test
public void testWebServiceTargetAdapterWithAllInOneMarshaller() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"marshallingWebServiceTargetAdapterParserTests.xml", this.getClass());
HandlerEndpoint endpoint =
(HandlerEndpoint) context.getBean("adapterWithAllInOneMarshaller");
assertEquals(MarshallingWebServiceTargetAdapter.class, endpoint.getHandler().getClass());
DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(endpoint.getHandler());
DirectFieldAccessor templateAccessor = new DirectFieldAccessor(
handlerAccessor.getPropertyValue("webServiceTemplate"));
Marshaller marshaller = (Marshaller) context.getBean("marshallerAndUnmarshaller");
assertEquals(marshaller, templateAccessor.getPropertyValue("marshaller"));
assertEquals(marshaller, templateAccessor.getPropertyValue("unmarshaller"));
}
@Test
public void testWebServiceTargetAdapterWithSeparateMarshallerAndUnmarshaller() {
ApplicationContext context = new ClassPathXmlApplicationContext(
"marshallingWebServiceTargetAdapterParserTests.xml", this.getClass());
HandlerEndpoint endpoint =
(HandlerEndpoint) context.getBean("adapterWithSeparateMarshallerAndUnmarshaller");
assertEquals(MarshallingWebServiceTargetAdapter.class, endpoint.getHandler().getClass());
DirectFieldAccessor handlerAccessor = new DirectFieldAccessor(endpoint.getHandler());
DirectFieldAccessor templateAccessor = new DirectFieldAccessor(
handlerAccessor.getPropertyValue("webServiceTemplate"));
Marshaller marshaller = (Marshaller) context.getBean("marshaller");
Unmarshaller unmarshaller = (Unmarshaller) context.getBean("unmarshaller");
assertEquals(marshaller, templateAccessor.getPropertyValue("marshaller"));
assertEquals(unmarshaller, templateAccessor.getPropertyValue("unmarshaller"));
}
}

View File

@@ -0,0 +1,26 @@
<?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:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-ws-1.0.xsd">
<si:message-bus/>
<si:channel id="testChannel"/>
<si:ws-target id="adapterWithAllInOneMarshaller" uri="http://example.org" channel="testChannel"
marshaller="marshallerAndUnmarshaller"/>
<si:ws-target id="adapterWithSeparateMarshallerAndUnmarshaller" uri="http://example.org" channel="testChannel"
marshaller="marshaller" unmarshaller="unmarshaller"/>
<bean id="marshallerAndUnmarshaller" class="org.springframework.integration.ws.config.StubMarshallerAndUnmarshaller"/>
<bean id="marshaller" class="org.springframework.integration.ws.config.StubMarshaller"/>
<bean id="unmarshaller" class="org.springframework.integration.ws.config.StubUnmarshaller"/>
</beans>

View File

@@ -0,0 +1,21 @@
<?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:si="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration-ws-1.0.xsd">
<si:message-bus/>
<si:channel id="testChannel"/>
<si:ws-target id="adapterWithDefaultSourceExtractor" uri="http://example.org" channel="testChannel"/>
<si:ws-target id="adapterWithCustomSourceExtractor" uri="http://example.org" channel="testChannel"
source-extractor="sourceExtractor"/>
<bean id="sourceExtractor" class="org.springframework.integration.ws.config.StubSourceExtractor"/>
</beans>