How can i validate SPML SOAP Requests in Spring Web Services if their XSDs have Unique Particle Attribution Errors?

StackOverflow https://stackoverflow.com/questions/14215615

Pregunta

I was wondering if anyone could point me in the right direction here.

I'm working on a project that needs to create web service functionality to adhere to the SPML v2 Spec (https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=provision). It's an XML based spec for provisioning services.

I've created the end points that map to the namespace and localpart of the soap requests fine. My issue lies in attempting to validate the payload requests in spring web services using the provided XSDs from the spec itself. From my research, it is an "Open Content Model", and any validation or attempt to compile the XSDs results in Unique Particle Attribution errors.

This happens because the CORE XSD has an "ExtensibleType" complexType that when other complexTypes extend from it causes the error. From my research, i can see why the error is occurring, but i don't want to modify the xsds provided by the spec itself.

Example:

<complexType name="ExtensibleType">
    <sequence>
        <any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
    </sequence>
    <anyAttribute namespace="##other" processContents="lax"/>
</complexType>



<complexType name="SearchQueryType">
    <complexContent>
        <extension base="spml:ExtensibleType">  
            <sequence>
                <annotation>
                    <documentation>Open content is one or more instances of QueryClauseType (including SelectionType) or LogicalOperator.</documentation>
                </annotation>

                <element name="basePsoID" type="spml:PSOIdentifierType"  minOccurs="0" />
            </sequence>
            <attribute name="targetID" type="string" use="optional"/>
            <attribute name="scope" type="spmlsearch:ScopeType" use="optional"/>
        </extension>
    </complexContent>               
</complexType>

This would result in the following error when attempting to validate the xsds:

cos-nonambig: WC[##other:"urn:oasis:names:tc:SPML:2:0"] and "urn:oasis:names:tc:SPML: 2:0:search":basePsoID (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.

Since the XSDs are invalid themselves, i'm having a duzy of a time figuring out how i can actually validate payload requests against the XSDS provided by the spec itself.

Adding the PayloadValidatingInterceptor in the spring context file results in the same error when the server attempts to start:

    <bean id="validatingInterceptor"
            class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
<property name="schemas">
                <list>
                    <value>/WEB-INF/xsd/spml/pstc_spmlv2_core.xsd</value>
                    <value>/WEB-INF/xsd/spml/pstc_spmlv2_search.xsd</value>
                </list>
            </property>
            <property name="validateRequest" value="true"/>
            <property name="validateResponse" value="false"/>
        </bean>

Thanks for anyone's input ahead of time, not sure if anyone ever ran into this type of issue or not.

Damian

¿Fue útil?

Solución

What you need to do is disable the Unique Particle Attribution check. In general, this works in Java (see this SO post), you just need to find a way to configure it... Worst case might be to build your own validator based on the above link - it should work since Spring's XSD schemas are using Apache's implementation.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top