2020
2121import org .apache .commons .logging .Log ;
2222import org .apache .commons .logging .LogFactory ;
23+
2324import org .springframework .beans .factory .InitializingBean ;
2425import org .springframework .oxm .Marshaller ;
2526import org .springframework .oxm .Unmarshaller ;
@@ -119,9 +120,7 @@ public final void setUnmarshaller(Unmarshaller unmarshaller) {
119120 this .unmarshaller = unmarshaller ;
120121 }
121122
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 {
125124 afterMarshallerSet ();
126125 }
127126
@@ -139,7 +138,9 @@ public final void invoke(MessageContext messageContext) throws Exception {
139138 }
140139
141140 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 );
143144 if (logger .isDebugEnabled ()) {
144145 logger .debug ("Unmarshalled payload request to [" + requestObject + "]" );
145146 }
@@ -161,10 +162,12 @@ protected boolean onUnmarshalRequest(MessageContext messageContext, Object reque
161162 }
162163
163164 private void marshalResponse (Object responseObject , WebServiceMessage response ) throws IOException {
165+ Marshaller marshaller = getMarshaller ();
166+ Assert .notNull (marshaller , "No marshaller registered. Check configuration of endpoint." );
164167 if (logger .isDebugEnabled ()) {
165168 logger .debug ("Marshalling [" + responseObject + "] to response payload" );
166169 }
167- MarshallingUtils .marshal (getMarshaller () , responseObject , response );
170+ MarshallingUtils .marshal (marshaller , responseObject , response );
168171 }
169172
170173 /**
@@ -184,6 +187,9 @@ protected void onMarshalResponse(MessageContext messageContext, Object requestOb
184187 * Template method that gets called after the marshaller and unmarshaller have been set.
185188 * <p/>
186189 * 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
187193 */
188194 public void afterMarshallerSet () throws Exception {
189195 }
0 commit comments