Skip to content

Commit a833243

Browse files
committed
Done working on WSDL in sandbox.
1 parent b56e631 commit a833243

File tree

53 files changed

+2902
-1957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2902
-1957
lines changed

sandbox/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@
6868
</dependency>
6969
<dependency>
7070
<groupId>org.springframework</groupId>
71-
<artifactId>spring-jmx</artifactId>
72-
<version>${spring.version}</version>
73-
<scope>test</scope>
71+
<artifactId>spring-test</artifactId>
7472
</dependency>
7573
<!-- JEE dependencies -->
7674
<dependency>
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
/*
2+
* Copyright 2008 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
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.SuffixBasedPortTypesProvider;
28+
import org.springframework.xml.xsd.XsdSchema;
29+
import org.springframework.xml.xsd.XsdSchemaCollection;
30+
31+
/**
32+
* Convenient implementation of {@link Wsdl11Definition} that creates a SOAP 1.1 or 1.2 binding based on naming
33+
* conventions in one or more inlined XSD schemas. Delegates to {@link InliningXsdSchemaTypesProvider}, {@link
34+
* DefaultMessagesProvider}, {@link SuffixBasedPortTypesProvider}, {@link SoapProvider} underneath; effectively
35+
* equivalent to using a {@link ProviderBasedWsdl4jDefinition} with all these providers.
36+
*
37+
* @author Arjen Poutsma
38+
* @since 1.5.0
39+
*/
40+
public class DefaultWsdl11Definition implements Wsdl11Definition, InitializingBean {
41+
42+
private final InliningXsdSchemaTypesProvider typesProvider = new InliningXsdSchemaTypesProvider();
43+
44+
private final DefaultMessagesProvider messagesProvider = new DefaultMessagesProvider();
45+
46+
private final SuffixBasedPortTypesProvider portTypesProvider = new SuffixBasedPortTypesProvider();
47+
48+
private final SoapProvider soapProvider = new SoapProvider();
49+
50+
private final ProviderBasedWsdl4jDefinition delegate = new ProviderBasedWsdl4jDefinition();
51+
52+
private String serviceName;
53+
54+
/** Creates a new instance of the {@link DefaultWsdl11Definition}. */
55+
public DefaultWsdl11Definition() {
56+
delegate.setTypesProvider(typesProvider);
57+
delegate.setMessagesProvider(messagesProvider);
58+
delegate.setPortTypesProvider(portTypesProvider);
59+
delegate.setBindingsProvider(soapProvider);
60+
delegate.setServicesProvider(soapProvider);
61+
}
62+
63+
/**
64+
* Sets the target namespace used for this definition.
65+
* <p/>
66+
* Defaults to the target namespace of the defined schema.
67+
*/
68+
public void setTargetNamespace(String targetNamespace) {
69+
delegate.setTargetNamespace(targetNamespace);
70+
}
71+
72+
/**
73+
* Sets the single XSD schema to inline. Either this property, or {@link #setSchemaCollection(XsdSchemaCollection)
74+
* schemaCollection} must be set.
75+
*/
76+
public void setSchema(final XsdSchema schema) {
77+
typesProvider.setSchema(schema);
78+
}
79+
80+
/**
81+
* Sets the XSD schema collection to inline. Either this property, or {@link #setSchema(XsdSchema) schema} must be
82+
* set.
83+
*/
84+
public void setSchemaCollection(XsdSchemaCollection schemaCollection) {
85+
typesProvider.setSchemaCollection(schemaCollection);
86+
}
87+
88+
/** Sets the port type name used for this definition. Required. */
89+
public void setPortTypeName(String portTypeName) {
90+
portTypesProvider.setPortTypeName(portTypeName);
91+
}
92+
93+
/** Sets the suffix used to detect request elements in the schema. */
94+
public void setRequestSuffix(String requestSuffix) {
95+
portTypesProvider.setRequestSuffix(requestSuffix);
96+
}
97+
98+
/** Sets the suffix used to detect response elements in the schema. */
99+
public void setResponseSuffix(String responseSuffix) {
100+
portTypesProvider.setResponseSuffix(responseSuffix);
101+
}
102+
103+
/** Sets the suffix used to detect fault elements in the schema. */
104+
public void setFaultSuffix(String faultSuffix) {
105+
portTypesProvider.setFaultSuffix(faultSuffix);
106+
}
107+
108+
/** Indicates whether a SOAP 1.1 binding should be created. */
109+
public void setCreateSoap11Binding(boolean createSoap11Binding) {
110+
soapProvider.setCreateSoap11Binding(createSoap11Binding);
111+
}
112+
113+
/** Indicates whether a SOAP 1.2 binding should be created. */
114+
public void setCreateSoap12Binding(boolean createSoap12Binding) {
115+
soapProvider.setCreateSoap12Binding(createSoap12Binding);
116+
}
117+
118+
/**
119+
* Sets the SOAP Actions for this binding. Keys are {@link javax.wsdl.BindingOperation#getName() binding operation
120+
* names}; values are {@link javax.wsdl.extensions.soap.SOAPOperation#getSoapActionURI() SOAP Action URIs}.
121+
*
122+
* @param soapActions the soap
123+
*/
124+
public void setSoapActions(Properties soapActions) {
125+
soapProvider.setSoapActions(soapActions);
126+
}
127+
128+
/** Sets the value used for the binding transport attribute value. Defaults to HTTP. */
129+
public void setTransportUri(String transportUri) {
130+
soapProvider.setTransportUri(transportUri);
131+
}
132+
133+
/** Sets the value used for the SOAP Address location attribute value. */
134+
public void setLocationUri(String locationUri) {
135+
soapProvider.setLocationUri(locationUri);
136+
}
137+
138+
/** Sets the service name. */
139+
public void setServiceName(String serviceName) {
140+
soapProvider.setServiceName(serviceName);
141+
this.serviceName = serviceName;
142+
}
143+
144+
public void afterPropertiesSet() throws Exception {
145+
if (!StringUtils.hasText(delegate.getTargetNamespace()) && typesProvider.getSchemaCollection() != null &&
146+
typesProvider.getSchemaCollection().getXsdSchemas().length > 0) {
147+
XsdSchema schema = typesProvider.getSchemaCollection().getXsdSchemas()[0];
148+
setTargetNamespace(schema.getTargetNamespace());
149+
}
150+
if (!StringUtils.hasText(serviceName) && StringUtils.hasText(portTypesProvider.getPortTypeName())) {
151+
soapProvider.setServiceName(portTypesProvider.getPortTypeName() + "Service");
152+
}
153+
delegate.afterPropertiesSet();
154+
}
155+
156+
public Source getSource() {
157+
return delegate.getSource();
158+
}
159+
}

sandbox/src/main/java/org/springframework/ws/wsdl/wsdl11/DomWsdl11Definition.java

Lines changed: 0 additions & 158 deletions
This file was deleted.

0 commit comments

Comments
 (0)