I have a problem with a contract based web service in Java. In my schema, I have something like this:
<element maxOccurs="1" minOccurs="1" name="GUID" type="xs:long" />
What generates a class with such a field:
protected long GUID;
Now, when I try to start my web service, when the values ββfor the GUID are not set, the default value for the new java long is set to (0) and no exception is thrown. Of course, this is not good behavior, because I have to use a guiding element. On the other hand, when I change my circuit element to something like this:
<element maxOccurs="1" minOccurs="0" name="GUID" type="xs:long" />
(which is wrong from a logical point of view, since a GUID element is required) the generated class field looks like this:
{protected Long GUID; }
And now that the GUID is not set in the web service execution, the GUID is null, and I can verify that I have selected an exception from the java code.
Therefore, I would like to ask you how to use the minOccurs = "0" generated class with a protected Long GUID; (or at least get an exception if this value is not set)
I am using JAXB, equipped with Glassfish 2.1.1 and SopaUI to execute web services.
source share