OPEN - issue INT-597: Add namespace support for inbound WS gateway

http://jira.springframework.org/browse/INT-597

Modified xsd, added namespace handler and testcase.
This commit is contained in:
Iwein Fuld
2009-03-12 13:43:47 +00:00
parent 3c9ddafdcd
commit 34a977a3a0
5 changed files with 212 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
/*
* 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.ws.config;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.integration.adapter.config.AbstractRemotingGatewayParser;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;
/**
*
* @author Iwein Fuld
*
*/
public class WebServiceInboundGatewayParser extends AbstractRemotingGatewayParser {
@Override
protected String getBeanClassName(Element element) {
String simpleClassName = (StringUtils.hasText(element.getAttribute("marshaller"))) ?
"MarshallingWebServiceInboundGateway" : "SimpleWebServiceInboundGateway";
return "org.springframework.integration.ws." + simpleClassName;
}
@Override
protected void doPostProcess(BeanDefinitionBuilder builder, Element element) {
String marshallerRef = element.getAttribute("marshaller");
if (StringUtils.hasText(marshallerRef)) {
builder.addPropertyReference("marshaller",marshallerRef);
String unmarshallerRef = element.getAttribute("unmarshaller");
if (StringUtils.hasText(unmarshallerRef)) {
builder.addPropertyReference("unmarshaller",unmarshallerRef);
}
}
}
}

View File

@@ -20,11 +20,13 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
* @author Mark Fisher
* @author Iwein Fuld
*/
public class WsNamespaceHandler extends NamespaceHandlerSupport {
public void init() {
this.registerBeanDefinitionParser("outbound-gateway", new WebServiceOutboundGatewayParser());
this.registerBeanDefinitionParser("inbound-gateway", new WebServiceInboundGatewayParser());
}
}

View File

@@ -115,4 +115,51 @@
</xsd:complexType>
</xsd:element>
<xsd:element name="inbound-gateway">
<xsd:complexType>
<xsd:annotation>
<xsd:documentation>
Defines a Web Service based inbound Messaging Gateway.
</xsd:documentation>
</xsd:annotation>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="request-channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="reply-channel" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.integration.core.MessageChannel"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="marshaller" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.oxm.Marshaller"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="unmarshaller" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.oxm.Unmarshaller"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="extract-payload" type="xsd:boolean"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>