20
20
21
21
import org .apache .commons .logging .Log ;
22
22
import org .apache .commons .logging .LogFactory ;
23
+
23
24
import org .springframework .beans .factory .InitializingBean ;
24
25
import org .springframework .oxm .Marshaller ;
25
26
import org .springframework .oxm .Unmarshaller ;
@@ -119,9 +120,7 @@ public final void setUnmarshaller(Unmarshaller unmarshaller) {
119
120
this .unmarshaller = unmarshaller ;
120
121
}
121
122
122
- public final void afterPropertiesSet () throws Exception {
123
- Assert .notNull (getMarshaller (), "marshaller is required" );
124
- Assert .notNull (getUnmarshaller (), "unmarshaller is required" );
123
+ public void afterPropertiesSet () throws Exception {
125
124
afterMarshallerSet ();
126
125
}
127
126
@@ -139,7 +138,9 @@ public final void invoke(MessageContext messageContext) throws Exception {
139
138
}
140
139
141
140
private Object unmarshalRequest (WebServiceMessage request ) throws IOException {
142
- Object requestObject = MarshallingUtils .unmarshal (getUnmarshaller (), request );
141
+ Unmarshaller unmarshaller = getUnmarshaller ();
142
+ Assert .notNull (unmarshaller , "No unmarshaller registered. Check configuration of endpoint." );
143
+ Object requestObject = MarshallingUtils .unmarshal (unmarshaller , request );
143
144
if (logger .isDebugEnabled ()) {
144
145
logger .debug ("Unmarshalled payload request to [" + requestObject + "]" );
145
146
}
@@ -161,10 +162,12 @@ protected boolean onUnmarshalRequest(MessageContext messageContext, Object reque
161
162
}
162
163
163
164
private void marshalResponse (Object responseObject , WebServiceMessage response ) throws IOException {
165
+ Marshaller marshaller = getMarshaller ();
166
+ Assert .notNull (marshaller , "No marshaller registered. Check configuration of endpoint." );
164
167
if (logger .isDebugEnabled ()) {
165
168
logger .debug ("Marshalling [" + responseObject + "] to response payload" );
166
169
}
167
- MarshallingUtils .marshal (getMarshaller () , responseObject , response );
170
+ MarshallingUtils .marshal (marshaller , responseObject , response );
168
171
}
169
172
170
173
/**
@@ -184,6 +187,9 @@ protected void onMarshalResponse(MessageContext messageContext, Object requestOb
184
187
* Template method that gets called after the marshaller and unmarshaller have been set.
185
188
* <p/>
186
189
* The default implementation does nothing.
190
+ *
191
+ * @deprecated as of Spring Web Services 1.5: {@link #afterPropertiesSet()} is no longer final, so this can safely
192
+ * be overriden in subclasses
187
193
*/
188
194
public void afterMarshallerSet () throws Exception {
189
195
}
0 commit comments