Search code examples
javaapache-axis

What does Axis2 disable strict validation (-Eosv in wsdl2java) allow, and how can it be made even less strict?


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?


Solution

  • 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.