cancel
Showing results for 
Search instead for 
Did you mean: 

Can not create WebService with java.util.Locale object why?

Former Member
0 Kudos

I am unable to create a WebService which contains a Locale Object in the request. I assume its because the java.util.Locale object is not Serializable. Can anyone tell me if there is a work around for this?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Make sure your strings for Locale follow these rules...

  • The language string should be lower-case, two-letter codes as defined by ISO-639.

http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt

  • The country string should be upper-case, two-letter codes as defined by ISO-3166.

http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html

Or try with some constant Locales like

Locale.CANADA

Locale.US

regards,

Uma

Former Member
0 Kudos

Hi Dan,

java.util.Locale is serializable. The reason for this issue is that Locale does not provide a parameterless constructor and no setters for the attributes (it is not a standard javabean). A simple workaround is to pass two strings instead of the whole Locale object in your webservice. One string for the country and one for the language.

regards

Sebastian

Former Member
0 Kudos

thanks, adding the Strings is what I have done.