@@ -140,6 +140,46 @@ public WebServiceTemplate(WebServiceMessageFactory messageFactory) {
140
140
initDefaultStrategies ();
141
141
}
142
142
143
+ /**
144
+ * Creates a new <code>WebServiceTemplate</code> with the given marshaller. If the given {@link
145
+ * Marshaller} also implements the {@link Unmarshaller} interface, it is used for both marshalling and
146
+ * unmarshalling. Otherwise, an exception is thrown.
147
+ * <p/>
148
+ * Note that all {@link Marshaller} implementations in Spring also implement the {@link Unmarshaller} interface,
149
+ * so that you can safely use this constructor.
150
+ *
151
+ * @param marshaller object used as marshaller and unmarshaller
152
+ * @throws IllegalArgumentException when <code>marshaller</code> does not implement the {@link Unmarshaller}
153
+ * interface
154
+ * @since 2.0.3
155
+ */
156
+ public WebServiceTemplate (Marshaller marshaller ) {
157
+ Assert .notNull (marshaller , "marshaller must not be null" );
158
+ if (!(marshaller instanceof Unmarshaller )) {
159
+ throw new IllegalArgumentException ("Marshaller [" + marshaller + "] does not implement the Unmarshaller " +
160
+ "interface. Please set an Unmarshaller explicitly by using the " +
161
+ "WebServiceTemplate(Marshaller, Unmarshaller) constructor." );
162
+ }
163
+ else {
164
+ this .setMarshaller (marshaller );
165
+ this .setUnmarshaller ((Unmarshaller ) marshaller );
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Creates a new <code>MarshallingMethodEndpointAdapter</code> with the given marshaller and unmarshaller.
171
+ *
172
+ * @param marshaller the marshaller to use
173
+ * @param unmarshaller the unmarshaller to use
174
+ * @since 2.0.3
175
+ */
176
+ public WebServiceTemplate (Marshaller marshaller , Unmarshaller unmarshaller ) {
177
+ Assert .notNull (marshaller , "marshaller must not be null" );
178
+ Assert .notNull (unmarshaller , "unmarshaller must not be null" );
179
+ this .setMarshaller (marshaller );
180
+ this .setUnmarshaller (unmarshaller );
181
+ }
182
+
143
183
/** Returns the default URI to be used on operations that do not have a URI parameter. */
144
184
public String getDefaultUri () {
145
185
if (destinationProvider != null ) {
0 commit comments