001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.camel.component.spring.ws;
018
019 import java.net.URI;
020 import java.net.URISyntaxException;
021
022 import org.apache.camel.component.spring.ws.bean.CamelEndpointDispatcher;
023 import org.apache.camel.component.spring.ws.bean.CamelEndpointMapping;
024 import org.apache.camel.component.spring.ws.type.EndpointMappingKey;
025 import org.apache.camel.converter.jaxp.XmlConverter;
026 import org.springframework.ws.client.core.WebServiceTemplate;
027
028 public class SpringWebserviceConfiguration {
029
030 /* Producer configuration */
031 private WebServiceTemplate webServiceTemplate;
032 private String soapAction;
033 private URI wsAddressingAction;
034
035 /* Consumer configuration */
036 private CamelEndpointMapping endpointMapping;
037 private CamelEndpointDispatcher endpointDispatcher;
038 private EndpointMappingKey endpointMappingKey;
039
040 private XmlConverter xmlConverter;
041
042 public WebServiceTemplate getWebServiceTemplate() {
043 return webServiceTemplate;
044 }
045
046 public void setWebServiceTemplate(WebServiceTemplate webServiceTemplate) {
047 this.webServiceTemplate = webServiceTemplate;
048 }
049
050 public String getSoapAction() {
051 return soapAction;
052 }
053
054 public void setSoapAction(String soapAction) {
055 this.soapAction = soapAction;
056 }
057
058 public String getEndpointUri() {
059 if (endpointMappingKey != null) {
060 // only for consumers, use lookup key as endpoint uri/key
061 return endpointMappingKey.getLookupKey();
062 } else if (webServiceTemplate != null) {
063 return webServiceTemplate.getDefaultUri();
064 }
065 return null;
066 }
067
068 public URI getWsAddressingAction() {
069 return wsAddressingAction;
070 }
071
072 public void setWsAddressingAction(URI wsAddressingAction) {
073 this.wsAddressingAction = wsAddressingAction;
074 }
075
076 public void setWsAddressingAction(String wsAddressingAction) throws URISyntaxException {
077 this.wsAddressingAction = new URI(wsAddressingAction);
078 }
079
080 public CamelEndpointMapping getEndpointMapping() {
081 return endpointMapping;
082 }
083
084 public void setEndpointMapping(CamelEndpointMapping endpointMapping) {
085 this.endpointMapping = endpointMapping;
086 }
087
088 public EndpointMappingKey getEndpointMappingKey() {
089 return endpointMappingKey;
090 }
091
092 public void setEndpointMappingKey(EndpointMappingKey endpointMappingKey) {
093 this.endpointMappingKey = endpointMappingKey;
094 }
095
096 public CamelEndpointDispatcher getEndpointDispatcher() {
097 return endpointDispatcher;
098 }
099
100 public void setEndpointDispatcher(CamelEndpointDispatcher endpointDispatcher) {
101 this.endpointDispatcher = endpointDispatcher;
102 }
103
104 public XmlConverter getXmlConverter() {
105 return xmlConverter;
106 }
107
108 public void setXmlConverter(XmlConverter xmlConverter) {
109 this.xmlConverter = xmlConverter;
110 }
111 }