Closed charlesmoore99 closed 6 years ago
Issue appears to be that the class net.opengis.swes.v_2_0_0.InsertionMetadataType in swes 2.0 needs to have the @XmlSeeAlso(SosInsertionMetadataType.class) annotation added to it.
I have no idea how to add this annotation using this build framework.
Could you commit your tests as PR in swes
or sos
modules? (Please move your sample XML to a resource.)
You include net.opengis.sos.v_2_0
into the context path, so actually SosInsertionMetadata
should be known in the context.
I know how to add @XmlSeeAlso
, but it is not the right solution. The JAXB context should be defined by the context path dynamically, not by annotations statically.
Please PR your tests, I'll take a look.
Thanks!
Pull Request created.
Thanks for the PR. The problem is that metadata
property of InsertSensorType
must be a reference property, otherwise substitution groups are not supported.
I have patches SWES so that InsertMetadata
element is generated as a reference property. With this patch I get both examples unmarshal allright, both tests are green.
Please give it a try before. You'll need to get the latest version and build it. Takes a while.
I pulled down the changes and rebuilt. Unit tests passed. Also ran tests in a stand alone environment, those passed too.
Ok, I'll try to release in the next days then.
I tested this against both the 2.6.1 release version and the 2.6.2-SNAPSHOT.
Unmarshalling a valid swes:InsertSensor document throws the following exception when an sos2:SosInsertionMetadata element is encountered
Note: without a ValidationEventHandler on the unmarshaller, JAXB silently fails to process the SosInsertionMetadata Element and calls to the getMetadata() method in the resulting insertSensor object return null.
The following java code demonstrates the above exception. Also included is a unit test that show that it is possible to trick JAXB into unmarshalling the SosInsertionMetadata via an xsi:type attribute