Internal Server Error (unexpected null value for literal data)

Here is a slightly different version of an error, that took me more than a blink off an eye to recognize.

Unlike in my previous post, the error is coming from the server, wrapped in a soap:fault.

<faultstring>Internal Server Error (unexpected null value for literal data)</faultstring>

The root cause is the same -- a serialization error, but this time on the implementation of the service instead of the client proxy. Remember that all the parts of the schema not marked as nullable or optional must have a value. And you have the same options to handle this:
  1. change your XML Schema, so that it's aligned with your code.
  2. add code in the generated JavaBean, so that you have default value set
  3. remember to always use all the setter when instantiating a new Java object that will be included in the response (this is error prone, so it's why I like #2 better).
Using SOAP UI was the quickest way to run and run again, until the server side was fixed - 0 line of code, and the ability to save and replay the same request over and over.

Hope this will save some time, some day, to some of you...


Olaf said…
Strangely enough, but Oracle AS implements this too.

Popular posts from this blog

Changing the version of JDK used by JDeveloper

Connection reset from a WCF Web Service

Test locally first, then deploy to the cloud.