forked from spring-projects/spring-integration
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spring-projectsGH-2818: DSL support for -ws module
Resolves spring-projects#2818
- Loading branch information
1 parent
8fb2018
commit 5789d74
Showing
11 changed files
with
993 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ion-ws/src/main/java/org/springframework/integration/ws/dsl/BaseWsInboundGatewaySpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2020 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 | ||
* | ||
* https://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.dsl; | ||
|
||
import org.springframework.integration.dsl.MessagingGatewaySpec; | ||
import org.springframework.integration.ws.AbstractWebServiceInboundGateway; | ||
import org.springframework.integration.ws.SoapHeaderMapper; | ||
|
||
/** | ||
* Base {@link MessagingGatewaySpec} for web services. | ||
* | ||
* @param <S> the target {@link BaseWsInboundGatewaySpec} implementation type. | ||
* @param <E> the target {@link AbstractWebServiceInboundGateway} implementation type. | ||
* | ||
* @author Gary Russell | ||
* @since 5.3 | ||
* | ||
*/ | ||
public class BaseWsInboundGatewaySpec< | ||
S extends BaseWsInboundGatewaySpec<S, E>, E extends AbstractWebServiceInboundGateway> | ||
extends MessagingGatewaySpec<S, E> { | ||
|
||
/** | ||
* Construct an instance for the gateway. | ||
* @param gateway the gateway. | ||
*/ | ||
protected BaseWsInboundGatewaySpec(E gateway) { | ||
super(gateway); | ||
} | ||
|
||
/** | ||
* Configure the header mapper. | ||
* @param headerMapper the mapper. | ||
* @return the spec. | ||
*/ | ||
public S headerMapper(SoapHeaderMapper headerMapper) { | ||
this.target.setHeaderMapper(headerMapper); | ||
return _this(); | ||
} | ||
|
||
} |
151 changes: 151 additions & 0 deletions
151
...on-ws/src/main/java/org/springframework/integration/ws/dsl/BaseWsOutboundGatewaySpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
/* | ||
* Copyright 2020 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 | ||
* | ||
* https://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.dsl; | ||
|
||
import java.util.Map; | ||
|
||
import org.springframework.expression.Expression; | ||
import org.springframework.integration.dsl.MessageHandlerSpec; | ||
import org.springframework.integration.ws.AbstractWebServiceOutboundGateway; | ||
import org.springframework.integration.ws.SoapHeaderMapper; | ||
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.client.support.interceptor.ClientInterceptor; | ||
import org.springframework.ws.transport.WebServiceMessageSender; | ||
|
||
/** | ||
* The base {@link MessageHandlerSpec} for {@link AbstractWebServiceOutboundGateway}s. | ||
* | ||
* @param <S> the target {@link BaseWsOutboundGatewaySpec} implementation type. | ||
* @param <E> the target {@link AbstractWebServiceOutboundGateway} implementation type. | ||
* | ||
* @author Gary Russell | ||
* @since 5.3 | ||
* | ||
*/ | ||
public class BaseWsOutboundGatewaySpec< | ||
S extends BaseWsOutboundGatewaySpec<S, E>, E extends AbstractWebServiceOutboundGateway> | ||
extends MessageHandlerSpec<S, E> { | ||
|
||
/** | ||
* Configure the header mapper. | ||
* @param headerMapper the mapper. | ||
* @return the spec. | ||
*/ | ||
public S headerMapper(SoapHeaderMapper headerMapper) { | ||
this.target.setHeaderMapper(headerMapper); | ||
return _this(); | ||
} | ||
|
||
/** | ||
* Set the Map of URI variable expressions to evaluate against the outbound message | ||
* when replacing the variable placeholders in a URI template. | ||
* @param uriVariableExpressions The URI variable expressions. | ||
* @return the spec. | ||
*/ | ||
public S uriVariableExpressions(Map<String, Expression> uriVariableExpressions) { | ||
this.target.setUriVariableExpressions(uriVariableExpressions); | ||
return _this(); | ||
} | ||
|
||
/** | ||
* Specify whether the URI should be encoded after any <code>uriVariables</code> | ||
* are expanded and before sending the request. The default value is <code>true</code>. | ||
* @param encodeUri true if the URI should be encoded. | ||
* @return the spec. | ||
* @see org.springframework.web.util.UriComponentsBuilder | ||
*/ | ||
public S encodeUri(boolean encodeUri) { | ||
this.target.setEncodeUri(encodeUri); | ||
return _this(); | ||
} | ||
|
||
/** | ||
* Specify whether empty String response payloads should be ignored. | ||
* The default is <code>true</code>. Set this to <code>false</code> if | ||
* you want to send empty String responses in reply Messages. | ||
* @param ignoreEmptyResponses true if empty responses should be ignored. | ||
* @return the spec. | ||
*/ | ||
public S ignoreEmptyResponses(boolean ignoreEmptyResponses) { | ||
this.target.setIgnoreEmptyResponses(ignoreEmptyResponses); | ||
return _this(); | ||
} | ||
|
||
/** | ||
* Specify the {@link WebServiceTemplate} to use. | ||
* @param webServiceTemplate the template. | ||
* @return the spec. | ||
*/ | ||
public S webServiceTemplate(WebServiceTemplate webServiceTemplate) { | ||
this.target.setWebServiceTemplate(webServiceTemplate); | ||
return _this(); | ||
} | ||
|
||
/** | ||
* Specify the {@link WebServiceMessageFactory} to use. | ||
* @param messageFactory the message factory. | ||
* @return the spec. | ||
*/ | ||
public S messageFactory(WebServiceMessageFactory messageFactory) { | ||
this.target.setMessageFactory(messageFactory); | ||
return _this(); | ||
} | ||
|
||
/** | ||
* Specify the {@link WebServiceMessageCallback} to use. | ||
* @param requestCallback the call back. | ||
* @return the spec. | ||
*/ | ||
public S requestCallback(WebServiceMessageCallback requestCallback) { | ||
this.target.setRequestCallback(requestCallback); | ||
return _this(); | ||
} | ||
|
||
/** | ||
* Specify the {@link FaultMessageResolver} to use. | ||
* @param faultMessageResolver the resolver. | ||
* @return the spec. | ||
*/ | ||
public S faultMessageResolver(FaultMessageResolver faultMessageResolver) { | ||
this.target.setFaultMessageResolver(faultMessageResolver); | ||
return _this(); | ||
} | ||
|
||
/** | ||
* Specify the {@link WebServiceMessageSender}s to use. | ||
* @param messageSenders the senders. | ||
* @return the spec. | ||
*/ | ||
public S messageSenders(WebServiceMessageSender... messageSenders) { | ||
this.target.setMessageSenders(messageSenders); | ||
return _this(); | ||
} | ||
|
||
/** | ||
* Specify the {@link ClientInterceptor}s to use. | ||
* @param interceptors the interceptors. | ||
* @return the spec. | ||
*/ | ||
public S interceptors(ClientInterceptor... interceptors) { | ||
this.target.setInterceptors(interceptors); | ||
return _this(); | ||
} | ||
|
||
} |
75 changes: 75 additions & 0 deletions
75
...src/main/java/org/springframework/integration/ws/dsl/MarshallingWsInboundGatewaySpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright 2020 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 | ||
* | ||
* https://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.dsl; | ||
|
||
import org.springframework.integration.ws.MarshallingWebServiceInboundGateway; | ||
import org.springframework.oxm.Marshaller; | ||
import org.springframework.oxm.Unmarshaller; | ||
|
||
/** | ||
* The spec for a {@link MarshallingWebServiceInboundGateway}. | ||
* | ||
* @author Gary Russell | ||
* @since 5.3 | ||
* | ||
*/ | ||
public class MarshallingWsInboundGatewaySpec extends BaseWsInboundGatewaySpec<MarshallingWsInboundGatewaySpec, | ||
MarshallingWebServiceInboundGateway> { | ||
|
||
protected MarshallingWsInboundGatewaySpec() { | ||
super(new MarshallingWebServiceInboundGateway()); | ||
} | ||
|
||
/** | ||
* Construct an instance with the provided {@link Marshaller} (which must also implement | ||
* {@link Unmarshaller}). | ||
* @param marshaller the marshaller. | ||
*/ | ||
protected MarshallingWsInboundGatewaySpec(Marshaller marshaller) { | ||
super(new MarshallingWebServiceInboundGateway(marshaller)); | ||
} | ||
|
||
/** | ||
* Construct an instance with the provided arguments. | ||
* @param marshaller the marshaller. | ||
* @param unmarshaller the unmarshaller. | ||
*/ | ||
protected MarshallingWsInboundGatewaySpec(Marshaller marshaller, Unmarshaller unmarshaller) { | ||
super(new MarshallingWebServiceInboundGateway(marshaller, unmarshaller)); | ||
} | ||
|
||
/** | ||
* Specify a marshaller to use. | ||
* @param marshaller the marshaller. | ||
* @return the spec. | ||
*/ | ||
public MarshallingWsInboundGatewaySpec marshaller(Marshaller marshaller) { | ||
this.target.setMarshaller(marshaller); | ||
return this; | ||
} | ||
|
||
/** | ||
* Specify an unmarshaller to use. | ||
* @param unmarshaller the unmarshaller. | ||
* @return the spec. | ||
*/ | ||
public MarshallingWsInboundGatewaySpec unmarshaller(Unmarshaller unmarshaller) { | ||
this.target.setUnmarshaller(unmarshaller); | ||
return this; | ||
} | ||
|
||
} |
Oops, something went wrong.