Consuming a SOAP web service error No marshaller registered. Check configuration of WebServiceTemplate
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
The error No marshaller registered. Check configuration of WebServiceTemplate means Spring Web Services is trying to send or receive Java objects through WebServiceTemplate, but the template has no configured marshaller and unmarshaller. In other words, Spring knows you want object-to-XML conversion, but it has not been told how to do that conversion.
Why the Error Happens
WebServiceTemplate can work in different modes. If you use methods such as marshalSendAndReceive, Spring expects a marshaller to turn your request object into SOAP XML and an unmarshaller to turn the response XML back into Java objects.
If those components are missing, the template cannot serialize the request payload, so it fails fast with the error you are seeing.
The usual fix is to configure a Jaxb2Marshaller and attach it to the template.
A Typical JAXB-Based Configuration
The contextPath should point to the package containing the JAXB-generated request and response classes, typically created from the WSDL.
Using the Template Correctly
Once the marshaller is registered, object-based calls work as expected.
This pattern only works when the request and response objects are compatible with your configured marshaller.
Another Way to Configure JAXB
Instead of contextPath, you can bind specific classes explicitly.
This is useful when the generated classes are small in number or you want tighter control over exactly what gets bound.
When You Do Not Need a Marshaller
Not every SOAP client call needs object marshalling. If you are sending raw XML sources manually, the marshaller may not be part of the path at all.
For example, if you use lower-level APIs that work with Source, DOM, or StringResult, the template is not trying to convert Java objects automatically.
That distinction matters. The error appears specifically when you call the object-marshalling path without the needed object-XML mapper.
Other Common Causes
Even after adding a marshaller, you can still have configuration problems if:
- the JAXB classes were not generated correctly from the WSDL
- the
contextPathpoints to the wrong package - only the marshaller was set and the unmarshaller was forgotten
- the request object is not one of the classes the marshaller knows how to serialize
So the fix is not only "add any marshaller." It is "add the correct marshaller for the classes you are actually sending and receiving."
Common Pitfalls
The most common mistake is calling marshalSendAndReceive without configuring both marshaller and unmarshaller.
Another mistake is pointing Jaxb2Marshaller at the wrong package, so it starts successfully but cannot marshal the actual payload classes.
A third pitfall is mixing raw XML usage and object-based usage without noticing that they require different WebServiceTemplate expectations.
Summary
- The error means
WebServiceTemplatewas asked to marshal Java objects without a configured marshaller. - The usual fix is to create a
Jaxb2Marshallerand register it as both marshaller and unmarshaller. - '
contextPathorclassesToBeBoundmust match the SOAP payload classes you actually use.' - Object-based calls such as
marshalSendAndReceiveneed marshalling support. - If you are sending raw XML instead of Java objects, the marshaller may not be part of the code path.
Related reading
- ContentCachingResponseWrapper Produces Empty Response
- ContextNotActiveException while calling Asynchronous method of Stateless bean
- ControllerAdvice and ExceptionHandler not getting triggered for my RestController
- Controlling Maven final name of jar artifact
- Conversion from ListT to array T
- Conversion to Dalvik format failed with error 1 on external JAR
- Convert a byte array to integer in Java and vice versa
- Convert a JSON String to a HashMap

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.