2020import java .util .List ;
2121import javax .xml .parsers .DocumentBuilder ;
2222import javax .xml .parsers .DocumentBuilderFactory ;
23- import javax .xml .parsers .ParserConfigurationException ;
2423import javax .xml .transform .Source ;
2524import javax .xml .transform .dom .DOMSource ;
2625
2928import org .w3c .dom .Node ;
3029import org .w3c .dom .NodeList ;
3130
32- import org .springframework .beans .factory .BeanNameAware ;
3331import org .springframework .beans .factory .InitializingBean ;
3432import org .springframework .util .Assert ;
35- import org .springframework .util .StringUtils ;
3633
3734/**
3835 * @author Arjen Poutsma
3936 * @since 1.5.0
4037 */
41- public class DomWsdl11Definition implements Wsdl11Definition , BeanNameAware , InitializingBean {
42-
43- private static final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance ();
38+ public class DomWsdl11Definition implements Wsdl11Definition , InitializingBean {
4439
4540 public static final String WSDL_NAMESPACE_URI = "http://schemas.xmlsoap.org/wsdl/" ;
4641
@@ -52,48 +47,26 @@ public class DomWsdl11Definition implements Wsdl11Definition, BeanNameAware, Ini
5247
5348 private String targetNamespace ;
5449
55- private String beanName ;
56-
57- private String name ;
58-
59- static {
60- documentBuilderFactory .setNamespaceAware (true );
61- }
62-
6350 public void setTargetNamespace (String targetNamespace ) {
6451 Assert .notNull (targetNamespace , "'targetNamespace' must not be null" );
6552 this .targetNamespace = targetNamespace ;
6653 }
6754
68- public void setName (String name ) {
69- Assert .notNull (name , "'name' must not be null" );
70- this .name = name ;
71- }
72-
7355 public Source getSource () {
7456 return new DOMSource (document );
7557 }
7658
77- public void setBeanName (String name ) {
78- this .beanName = name ;
79- }
80-
8159 public void afterPropertiesSet () throws Exception {
8260 Assert .notNull (targetNamespace , "'targetNamespace' is required" );
83- if (!StringUtils .hasLength (name )) {
84- this .name = beanName ;
85- }
86- DocumentBuilder documentBuilder = createDocumentBuilder ();
61+ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance ();
62+ DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder ();
8763 document = documentBuilder .newDocument ();
8864 Element definitions = createDefinitions (document );
8965 document .appendChild (definitions );
9066 }
9167
9268 public Element createDefinitions (Document document ) {
9369 Element definitions = createWsdlElement (document , "definitions" );
94- if (StringUtils .hasLength (name )) {
95- definitions .setAttribute ("name" , name );
96- }
9770 declareNamespaces (definitions );
9871 definitions .setAttribute ("targetNamespace" , targetNamespace );
9972 addImports (document , definitions );
@@ -114,7 +87,6 @@ protected void declareNamespaces(Element definitions) {
11487 protected void addImports (Document document , Element definitions ) {
11588 }
11689
117-
11890 protected void addTypes (Document document , Element definitions ) {
11991 }
12092
@@ -130,13 +102,7 @@ protected void addBindings(Document document, Element definitions) {
130102 protected void addServices (Document document , Element definitions ) {
131103 }
132104
133- protected DocumentBuilder createDocumentBuilder () throws ParserConfigurationException {
134- return documentBuilderFactory .newDocumentBuilder ();
135- }
136-
137105 protected void declareNamespace (Element element , String namespacePrefix , String namespaceUri ) {
138- Assert .hasLength (namespacePrefix , "No prefix given" );
139- Assert .hasLength (namespaceUri , "No namespace given" );
140106 element .setAttributeNS ("http://www.w3.org/2000/xmlns/" , "xmlns:" + namespacePrefix , namespaceUri );
141107 }
142108
0 commit comments