37
37
import javax .xml .parsers .DocumentBuilderFactory ;
38
38
import javax .xml .parsers .ParserConfigurationException ;
39
39
40
+ import org .w3c .dom .Document ;
41
+ import org .w3c .dom .Element ;
42
+ import org .xml .sax .SAXException ;
43
+
40
44
import org .springframework .beans .factory .InitializingBean ;
41
45
import org .springframework .core .io .Resource ;
42
46
import org .springframework .util .Assert ;
43
47
import org .springframework .util .StringUtils ;
44
48
import org .springframework .ws .wsdl .wsdl11 .DynamicWsdl11Definition ;
45
49
import org .springframework .xml .namespace .QNameUtils ;
46
- import org .w3c .dom .Document ;
47
- import org .w3c .dom .Element ;
48
- import org .xml .sax .SAXException ;
49
50
50
51
/**
51
52
* Builds a <code>WsdlDefinition</code> with a SOAP 1.2 binding based on an XSD schema. This builder iterates over all
86
87
public class XsdBasedSoap12Wsdl4jDefinitionBuilder extends AbstractSoap12Wsdl4jDefinitionBuilder
87
88
implements InitializingBean {
88
89
89
- /**
90
- * The default suffix used to detect request elements in the schema.
91
- */
90
+ /** The default suffix used to detect request elements in the schema. */
92
91
public static final String DEFAULT_REQUEST_SUFFIX = "Request" ;
93
92
94
- /**
95
- * The default suffix used to detect response elements in the schema.
96
- */
93
+ /** The default suffix used to detect response elements in the schema. */
97
94
public static final String DEFAULT_RESPONSE_SUFFIX = "Response" ;
98
95
99
- /**
100
- * The default suffix used to detect fault elements in the schema.
101
- */
96
+ /** The default suffix used to detect fault elements in the schema. */
102
97
public static final String DEFAULT_FAULT_SUFFIX = "Fault" ;
103
98
104
- /**
105
- * The default prefix used to register the schema namespace in the WSDL.
106
- */
99
+ /** The default prefix used to register the schema namespace in the WSDL. */
107
100
public static final String DEFAULT_SCHEMA_PREFIX = "schema" ;
108
101
109
- /**
110
- * The default prefix used to register the target namespace in the WSDL.
111
- */
102
+ /** The default prefix used to register the target namespace in the WSDL. */
112
103
public static final String DEFAULT_PREFIX = "tns" ;
113
104
114
- /**
115
- * The suffix used to create a service name from a port type name.
116
- */
105
+ /** The suffix used to create a service name from a port type name. */
117
106
public static final String SERVICE_SUFFIX = "Service" ;
118
107
119
108
private Resource schemaResource ;
@@ -165,16 +154,12 @@ public void setFaultSuffix(String faultSuffix) {
165
154
this .faultSuffix = faultSuffix ;
166
155
}
167
156
168
- /**
169
- * Sets the port type name used for this definition. Required.
170
- */
157
+ /** Sets the port type name used for this definition. Required. */
171
158
public void setPortTypeName (String portTypeName ) {
172
159
this .portTypeName = portTypeName ;
173
160
}
174
161
175
- /**
176
- * Sets the target namespace used for this definition.
177
- */
162
+ /** Sets the target namespace used for this definition. */
178
163
public void setTargetNamespace (String targetNamespace ) {
179
164
this .targetNamespace = targetNamespace ;
180
165
}
@@ -197,9 +182,7 @@ public void setPrefix(String prefix) {
197
182
this .prefix = prefix ;
198
183
}
199
184
200
- /**
201
- * Sets the XSD schema to use for generating the WSDL.
202
- */
185
+ /** Sets the XSD schema to use for generating the WSDL. */
203
186
public void setSchema (Resource schemaResource ) {
204
187
Assert .notNull (schemaResource , "'schema' must not be null" );
205
188
Assert .isTrue (schemaResource .exists (), "schema \" " + schemaResource + "\" does not exit" );
@@ -232,9 +215,7 @@ public final void afterPropertiesSet() throws IOException, ParserConfigurationEx
232
215
}
233
216
}
234
217
235
- /**
236
- * Adds the target namespace and schema namespace to the definition.
237
- */
218
+ /** Adds the target namespace and schema namespace to the definition. */
238
219
protected void populateDefinition (Definition definition ) throws WSDLException {
239
220
super .populateDefinition (definition );
240
221
definition .setTargetNamespace (targetNamespace );
@@ -244,9 +225,7 @@ protected void populateDefinition(Definition definition) throws WSDLException {
244
225
}
245
226
}
246
227
247
- /**
248
- * Does nothing.
249
- */
228
+ /** Does nothing. */
250
229
protected void buildImports (Definition definition ) throws WSDLException {
251
230
}
252
231
@@ -301,7 +280,7 @@ protected void buildMessages(Definition definition) throws WSDLException {
301
280
QName elementName = (QName ) iterator .next ();
302
281
if (elementName != null &&
303
282
(isRequestMessage (elementName ) || isResponseMessage (elementName ) || isFaultMessage (elementName ))) {
304
- if (! StringUtils . hasLength ( definition .getPrefix (elementName .getNamespaceURI ())) ) {
283
+ if (definition .getPrefix (elementName .getNamespaceURI ()) == null ) {
305
284
int i = 0 ;
306
285
while (true ) {
307
286
String prefix = schemaPrefix + Integer .toString (i );
@@ -517,9 +496,7 @@ protected void populateOperation(Operation operation, Message requestMessage, Me
517
496
operation .setName (operationName );
518
497
}
519
498
520
- /**
521
- * Sets the name of the service to the name of the port type, with "Service" appended to it.
522
- */
499
+ /** Sets the name of the service to the name of the port type, with "Service" appended to it. */
523
500
protected void populateService (Service service ) throws WSDLException {
524
501
service .setQName (new QName (targetNamespace , portTypeName + SERVICE_SUFFIX ));
525
502
}
0 commit comments