4

In my application, I am using JSF and Java Web Services. When any of my web-service functions return a null value, it is always expressed as a "null" string. As a consequence, I cannot use EL expressions like #{empty object} to test for null values or empty strings.

I'd like to ask if there's a way to configure such that Java Web Services will return null value as an empty string OR JSF/EL can understand "null" string as null value.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Mr.J4mes
  • 9,168
  • 9
  • 48
  • 90

1 Answers1

0

if you,

  • using SOAP, you must remember that the SOAP message is an XML, so you can return an empty String as null or empty object

  • using HTTP or REST, you must remember that the HTTP using type of String to serialize the object and informations

So you have choose:

  • right serialization of return objects. If you using SOAP, remember Base64 encoding.

  • right output value for errors. You can serialize directly the exceptions or your custom message codes.

I hope to help you.

Giorgio Desideri
  • 169
  • 1
  • 12