We have answer of your question!

100% solved queries, no empty question

0

Advertisement


I am developing a Web service using Apache CXF and contract first approach with schema validation. Problem is, that validation is not working. There is no error, so it like is not activated. But validation is configured.

So, I have took a look to official Apache CXF examples you can find here.

I took a look to wsdl_first example and modify it adding schema validation and some restriction in WSDL:

<!-- HTTP Endpoint -->
<jaxws:endpoint xmlns:customer="http://customerservice.example.com/"
    id="CustomerServiceHTTP" address="http://localhost:9090/CustomerServicePort"
    serviceName="customer:CustomerServiceService" endpointName="customer:CustomerServiceEndpoint"
    implementor="com.example.customerservice.server.CustomerServiceImpl">

    <jaxws:features>
        <bean class="org.apache.cxf.feature.LoggingFeature" />
    </jaxws:features>
            <!-- schema validation-->
    <jaxws:properties>
        <entry key="schema-validation-enabled" value="true" />
    </jaxws:properties>
</jaxws:endpoint>

To my surprise, it doesn't work either.

OK, so I took a look to wsdl_first_xmlbeans example, where according with the README.txt file, it also shows how CXF configuration can be used to enable schema validation.

And for this example, schema validation works. The difference between both examples is that the second one use JAX-WS APIs and with the XMLBeans approach. Does it have something to do? Why schema validation is not working for first example? Probably, I am missing something.

Question author Jddsantaella | Source

Answer


1


Advertisement


For validation on the service side, it would likely need to have a wsdlLocation attribute set on the jaxws:endpoint so it would load the WSDL (that would then contain the schemas). Currently, the validation in that example is on the client side only. If you run the service, the log shows:

INFO: Creating Service {http://server.customerservice.example.com/}CustomerServiceImplService from class com.example.customerservice.CustomerService

which shows it's not using the WSDL at all.

Answer author Daniel-kulp

Advertisement


Tickanswer.com is providing the only single recommended solution of the question Apache CFX Schema validation - contract first under the categories i.e web-services , validation , schema , cxf , contract-first , . Our team of experts filter the best solution for you.

Related Search Queries:

You may also add your answer!