Spring WS SimpleXsdSchema can not access xsd schema included in wsdl

Viewed 117

The wsdl I am working does not have seperate xsd file. XSD Schema is included in wsdl file as shown below

<wsdl:definitions name="myProject"
                  targetNamespace="http://www.company.gr/myProject/definitions"
                  xmlns:tns="http://www.company.gr/myProject/definitions"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:xsd1="http://www.company.gr/myProject/schemas">

    <wsdl:types>
        <schema
                targetNamespace="http://www.company.gr/myProject/schemas"
                xmlns="http://www.w3.org/2001/XMLSchema">

        <simpleType name="aaa">
            ...
        </simpleType>

...

And I would like add a validation interceptor with the following code:

@Override
public void addInterceptors(List<EndpointInterceptor> interceptors) {
    PayloadValidatingInterceptor validatingInterceptor = new PayloadValidatingInterceptor();
    validatingInterceptor.setValidateRequest(true);
    validatingInterceptor.setValidateResponse(true);
    validatingInterceptor.setXsdSchema(mySchema());
    interceptors.add(validatingInterceptor);
}

@Bean
public XsdSchema mySchema(){
    return new SimpleXsdSchema(new ClassPathResource("**myWSDL.wsdl#types**"));
}

But the schema can't be found when using myWSDL.wsdl#types .

Is there a way to access the schema without restructuring the wsdl to externalize the xsd schema?

0 Answers
Related