I am using a SOAP service that omits and reorders XML elements in a xsd:sequence, just like it was in a xsd:any.
I tried wsdl2java -Eosv but the generated code rejects the SOAP responses with org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement
What type of checking is disabled with -Eosv?
Is it possible to make it even less strict?
Having tried to understand this in my dealings with Axis 2 v1.4.1, I ended up skimming through the source code. As documented in the WSDL2Java page and usage text, the -E options are passed to the databinding modules - in the case of -Eosv, the "osv" sub-option passed to is the ADB module. Digging down into the code generation for ADB, I found that the osv (OFF_STRICT_VALIDATION) option is only used to when determining the minOccurs. From org.apache.axis2.schema.SchemaCompiler in Axis 2 v1.4.1:
// if the strict validation off then we consider all elements have minOccurs zero on it
if (this.options.isOffStrictValidation()){
metainfHolder.addMinOccurs(referencedQName, 0);
} else {
metainfHolder.addMinOccurs(referencedQName, elt.getMinOccurs());
}
Obviously, relying on the source code for expected behaviour is never wise as the implementation will change between versions, but I have so far found no "official" documentation on what -Eosv option is meant to do other than the vague statement "turn off strict validation". I have not found any other options to make it less strict either.
Is it possible to make it even less strict?
https://axis.apache.org/axis2/java/core/docs/reference.html
-Eiu (for ADB) - Ignore Unexpected elements instead of throwing ADBException.
With the latest Axis2 1.7.4, -Eiu does suppress the exception but the webservice response parsed by the client doesn't contain all the elements.
If you face similar problems it is worth creating the client using JiBX binding instead of ADB. Instructions are here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With