1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.wsdl.wsdl11;
18
19 import java.util.Properties;
20 import javax.xml.transform.Source;
21
22 import org.springframework.beans.factory.InitializingBean;
23 import org.springframework.util.StringUtils;
24 import org.springframework.ws.wsdl.wsdl11.provider.DefaultMessagesProvider;
25 import org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider;
26 import org.springframework.ws.wsdl.wsdl11.provider.SoapProvider;
27 import org.springframework.ws.wsdl.wsdl11.provider.SuffixBasedMessagesProvider;
28 import org.springframework.ws.wsdl.wsdl11.provider.SuffixBasedPortTypesProvider;
29 import org.springframework.xml.xsd.XsdSchema;
30 import org.springframework.xml.xsd.XsdSchemaCollection;
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 public class DefaultWsdl11Definition implements Wsdl11Definition, InitializingBean {
55
56 private final InliningXsdSchemaTypesProvider typesProvider = new InliningXsdSchemaTypesProvider();
57
58 private final SuffixBasedMessagesProvider messagesProvider = new SuffixBasedMessagesProvider();
59
60 private final SuffixBasedPortTypesProvider portTypesProvider = new SuffixBasedPortTypesProvider();
61
62 private final SoapProvider soapProvider = new SoapProvider();
63
64 private final ProviderBasedWsdl4jDefinition delegate = new ProviderBasedWsdl4jDefinition();
65
66 private String serviceName;
67
68
69 public DefaultWsdl11Definition() {
70 delegate.setTypesProvider(typesProvider);
71 delegate.setMessagesProvider(messagesProvider);
72 delegate.setPortTypesProvider(portTypesProvider);
73 delegate.setBindingsProvider(soapProvider);
74 delegate.setServicesProvider(soapProvider);
75 }
76
77
78
79
80
81
82 public void setTargetNamespace(String targetNamespace) {
83 delegate.setTargetNamespace(targetNamespace);
84 }
85
86
87
88
89
90 public void setSchema(XsdSchema schema) {
91 typesProvider.setSchema(schema);
92 }
93
94
95
96
97
98 public void setSchemaCollection(XsdSchemaCollection schemaCollection) {
99 typesProvider.setSchemaCollection(schemaCollection);
100 }
101
102
103 public void setPortTypeName(String portTypeName) {
104 portTypesProvider.setPortTypeName(portTypeName);
105 }
106
107
108 public void setRequestSuffix(String requestSuffix) {
109 portTypesProvider.setRequestSuffix(requestSuffix);
110 messagesProvider.setRequestSuffix(requestSuffix);
111 }
112
113
114 public void setResponseSuffix(String responseSuffix) {
115 portTypesProvider.setResponseSuffix(responseSuffix);
116 messagesProvider.setResponseSuffix(responseSuffix);
117 }
118
119
120 public void setFaultSuffix(String faultSuffix) {
121 portTypesProvider.setFaultSuffix(faultSuffix);
122 messagesProvider.setFaultSuffix(faultSuffix);
123 }
124
125
126
127
128
129
130 public void setCreateSoap11Binding(boolean createSoap11Binding) {
131 soapProvider.setCreateSoap11Binding(createSoap11Binding);
132 }
133
134
135
136
137
138
139 public void setCreateSoap12Binding(boolean createSoap12Binding) {
140 soapProvider.setCreateSoap12Binding(createSoap12Binding);
141 }
142
143
144
145
146
147
148
149 public void setSoapActions(Properties soapActions) {
150 soapProvider.setSoapActions(soapActions);
151 }
152
153
154 public void setTransportUri(String transportUri) {
155 soapProvider.setTransportUri(transportUri);
156 }
157
158
159 public void setLocationUri(String locationUri) {
160 soapProvider.setLocationUri(locationUri);
161 }
162
163
164
165
166
167
168 public void setServiceName(String serviceName) {
169 soapProvider.setServiceName(serviceName);
170 this.serviceName = serviceName;
171 }
172
173 public void afterPropertiesSet() throws Exception {
174 if (!StringUtils.hasText(delegate.getTargetNamespace()) && typesProvider.getSchemaCollection() != null &&
175 typesProvider.getSchemaCollection().getXsdSchemas().length > 0) {
176 XsdSchema schema = typesProvider.getSchemaCollection().getXsdSchemas()[0];
177 setTargetNamespace(schema.getTargetNamespace());
178 }
179 if (!StringUtils.hasText(serviceName) && StringUtils.hasText(portTypesProvider.getPortTypeName())) {
180 soapProvider.setServiceName(portTypesProvider.getPortTypeName() + "Service");
181 }
182 delegate.afterPropertiesSet();
183 }
184
185 public Source getSource() {
186 return delegate.getSource();
187 }
188 }