1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.springframework.ws.wsdl.wsdl11.builder;
18
19 import javax.wsdl.Binding;
20 import javax.wsdl.BindingFault;
21 import javax.wsdl.BindingInput;
22 import javax.wsdl.BindingOperation;
23 import javax.wsdl.BindingOutput;
24 import javax.wsdl.Definition;
25 import javax.wsdl.Fault;
26 import javax.wsdl.Input;
27 import javax.wsdl.Operation;
28 import javax.wsdl.Output;
29 import javax.wsdl.Port;
30 import javax.wsdl.PortType;
31 import javax.wsdl.WSDLException;
32 import javax.wsdl.extensions.ExtensibilityElement;
33 import javax.wsdl.extensions.ExtensionRegistry;
34 import javax.wsdl.extensions.soap.SOAPAddress;
35 import javax.wsdl.extensions.soap.SOAPBinding;
36 import javax.wsdl.extensions.soap.SOAPBody;
37 import javax.wsdl.extensions.soap.SOAPFault;
38 import javax.wsdl.extensions.soap.SOAPOperation;
39 import javax.xml.namespace.QName;
40
41
42
43
44
45
46
47
48
49
50
51 public abstract class AbstractSoap11Wsdl4jDefinitionBuilder extends AbstractBindingWsdl4jDefinitionBuilder {
52
53 private static final String WSDL_SOAP_NAMESPACE_URI = "http://schemas.xmlsoap.org/wsdl/soap/";
54
55 private static final String WSDL_SOAP_PREFIX = "soap";
56
57
58 public static final String DEFAULT_TRANSPORT_URI = "http://schemas.xmlsoap.org/soap/http";
59
60 private String transportUri = DEFAULT_TRANSPORT_URI;
61
62 private String locationUri;
63
64
65
66
67
68
69
70 public void setTransportUri(String transportUri) {
71 this.transportUri = transportUri;
72 }
73
74
75 public void setLocationUri(String locationUri) {
76 this.locationUri = locationUri;
77 }
78
79
80 protected void populateDefinition(Definition definition) throws WSDLException {
81 definition.addNamespace(WSDL_SOAP_PREFIX, WSDL_SOAP_NAMESPACE_URI);
82 }
83
84
85
86
87
88
89
90
91
92 protected void populateBinding(Binding binding, PortType portType) throws WSDLException {
93 super.populateBinding(binding, portType);
94 SOAPBinding soapBinding = (SOAPBinding) createSoapExtension(Binding.class, "binding");
95 populateSoapBinding(soapBinding);
96 binding.addExtensibilityElement(soapBinding);
97 }
98
99
100
101
102
103
104
105
106
107
108
109
110
111 protected void populateSoapBinding(SOAPBinding soapBinding) throws WSDLException {
112 soapBinding.setStyle("document");
113 soapBinding.setTransportURI(transportUri);
114 }
115
116
117
118
119
120
121
122
123 protected void populateBindingOperation(BindingOperation bindingOperation, Operation operation)
124 throws WSDLException {
125 super.populateBindingOperation(bindingOperation, operation);
126 SOAPOperation soapOperation = (SOAPOperation) createSoapExtension(BindingOperation.class, "operation");
127 populateSoapOperation(soapOperation);
128 bindingOperation.addExtensibilityElement(soapOperation);
129 }
130
131
132
133
134
135
136
137
138
139
140 protected void populateSoapOperation(SOAPOperation soapOperation) throws WSDLException {
141 soapOperation.setSoapActionURI("");
142 }
143
144
145
146
147
148
149
150 protected void populateBindingInput(BindingInput bindingInput, Input input) throws WSDLException {
151 super.populateBindingInput(bindingInput, input);
152 SOAPBody soapBody = (SOAPBody) createSoapExtension(BindingInput.class, "body");
153 populateSoapBody(soapBody);
154 bindingInput.addExtensibilityElement(soapBody);
155 }
156
157
158
159
160
161
162
163 protected void populateBindingOutput(BindingOutput bindingOutput, Output output) throws WSDLException {
164 super.populateBindingOutput(bindingOutput, output);
165 SOAPBody soapBody = (SOAPBody) createSoapExtension(BindingOutput.class, "body");
166 populateSoapBody(soapBody);
167 bindingOutput.addExtensibilityElement(soapBody);
168 }
169
170
171
172
173
174
175
176 protected void populateBindingFault(BindingFault bindingFault, Fault fault) throws WSDLException {
177 super.populateBindingFault(bindingFault, fault);
178 SOAPFault soapFault = (SOAPFault) createSoapExtension(BindingFault.class, "fault");
179 populateSoapFault(bindingFault, soapFault);
180 bindingFault.addExtensibilityElement(soapFault);
181 }
182
183
184
185
186
187
188
189
190
191 protected void populateSoapBody(SOAPBody soapBody) throws WSDLException {
192 soapBody.setUse("literal");
193 }
194
195
196
197
198
199
200
201
202
203
204 protected void populateSoapFault(BindingFault bindingFault, SOAPFault soapFault) throws WSDLException {
205 soapFault.setName(bindingFault.getName());
206 soapFault.setUse("literal");
207 }
208
209
210
211
212
213
214
215 protected void populatePort(Port port, Binding binding) throws WSDLException {
216 super.populatePort(port, binding);
217 SOAPAddress soapAddress = (SOAPAddress) createSoapExtension(Port.class, "address");
218 populateSoapAddress(soapAddress);
219 port.addExtensibilityElement(soapAddress);
220 }
221
222
223
224
225
226
227
228
229
230
231 protected void populateSoapAddress(SOAPAddress soapAddress) throws WSDLException {
232 soapAddress.setLocationURI(locationUri);
233 }
234
235
236
237
238
239
240
241
242
243
244 protected ExtensibilityElement createSoapExtension(Class parentType, String localName) throws WSDLException {
245 return createExtension(parentType, new QName(WSDL_SOAP_NAMESPACE_URI, localName));
246 }
247
248 }