Validate jaxws soap request against schema inside wsdl:types
-
09-10-2019 - |
Question
I'm wanting to validate a soap request against the schema inside this wsdl.
<wsdl:types >
<xsd:schema targetNamespace="http://ws.thecompany.com/FormSubmissionService20100824"
xmlns:request="http://xmlschema.thecompany.com/generic/FormHeader20100824" xmlns:response="http://xmlschema.thecompany.com/generic/FormResponse20100824">
<xsd:import namespace="http://xmlschema.thecompany.com/generic/FormHeader20100824" schemaLocation="../schema/generic/FormHeader20100824.xsd"/>
<xsd:import namespace="http://xmlschema.thecompany.com/generic/FormResponse20100824" schemaLocation="../schema/generic/FormResponse20100824.xsd"/>
<xsd:element name="submitFormRequest" type="request:FormHeader"/>
<xsd:element name="submitFormResponse" type="response:FormResponse"/>
</xsd:schema>
</wsdl:types>
<!-- Message Definition -->
<wsdl:message name="submitFormRequest">
<wsdl:part element="thecomp:submitFormRequest" name="request" />
</wsdl:message>
Loading a javax.xml.validation.Validator
for the schema validating against a < thecomp:submitFormRequest>
element doesn't work, neither does attempting to load the wsdl as the schema.
Ideas please? (using jax-ws, was7)
Cheers
Solution
I extracted the request/response into its own schema file:
<wsdl:types >
<xsd:schema>
<xsd:import namespace="http://ws.acc.co.nz/ACCFormSubmissionService20100824"
schemaLocation="../schema/ws/ACCFormSubmissionService20100824.xsd" />
</xsd:schema>
</wsdl:types>
Validating against the new schema namespace/xsd works as required.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow