Search code examples
androidxmlsoapksoap2

kSOAP2 a little too strict with double ID exceptions?


kSOAP2 refuses to parse a SOAP response I'm getting because it contains 2 elements with the same id value. The thing is that in the XML Schema, this id is of type anyURI, not xs:ID, so it doesn't have any unicity semantic: https://github.com/oehf/ipf/blob/8a22c51a47fab1af6fea7da81f9e5d8de636e225/commons/ihe/xds/src/main/resources/wsdl/schema/ebRS30/rim.xsd#L103

Is that a bug in kSOAP2 or is there a way to disable that exception?


Solution

  • The documentation says:

    Common base type for all types that have unique identity.     
    If id is provided and is not in proper URN syntax then it is used for
    linkage within document and is ignored by the registry. In this case the
    registry generates a UUID URN for id attribute.
    id must not be null when object is retrieved from the registry.
    

    Just because something is schema-valid doesn't mean it satisfies all the constraints imposed by the application. I'm not familiar with this specification, but it's perfectly legitimate for a specification to impose constraints beyond those in the XML schema. There's certainly a suggestion in this annotation that such constraints exist.