You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Daniel Pike <da...@gmail.com> on 2008/10/27 11:32:39 UTC

SOAP message schema validation with CXF endpoint

I am currently trying to implement a CXF endpoint to receive messages
based on a wsdl specification, route the message through a number of beans
and xml transformations and then return the message as a SOAP response.
This all seems to be working except I have been unable to get CXF to perform
schema validation on the SOAP messages received.  In my spring application
context, I have the CXF endpoint and camel context/route setup as below.
<cxfEndpoint xmlns="http://activemq.apache.org/camel/schema/cxfEndpoint"
                 id="serviceEndpoint"
                 wsdlURL="META-INF/wsdl/service.wsdl"
                 serviceClass="com.services.Service"
                 address="/Service">
        <properties>
            <beans:entry key="schema-validation-enabled" value="true"/>
        </properties>
</cxfEndpoint>

<camelContext id="camelContext" xmlns="
http://activemq.apache.org/camel/schema/spring">
        <route>
            <from uri="cxf:bean:serviceEndpoint"/>
            <to uri="log:service"/>
            <convertBodyTo type="java.lang.String"/>
            <to uri="xslt:META-INF/xsl/messageTransformation.xsl"/>
            <to uri="bean:messageSenderBean?methodName=sendMessage"/>
        </route>
</camelContext>

When I send a message to CXF in a format that does not comply to the schema
defined in the WSDL, CXF does not perform the validation and the message
passes through successfully.  Does anyone know why this might not be
working?  Is there any way to perform schema validation using CXF and Camel?

Thanks

Dan.

Re: SOAP message schema validation with CXF endpoint

Posted by Willem Jiang <wi...@gmail.com>.
Hi Dan,

I just add a test to verify the issue, the schema validation
configuration should work in my case[1][2].

Since the schema validation is based on JAXB's marshal and unmarshal, so
you need to configure the CXF Endpoint's data formate to be POJO.

>From you description, I don't think convert a parameter list into a xml
String, so I think your CXF Endpoint's data fromate is MESSAGE which
just leverage the CXF transport and does't touch any JAXB stuff.

So that is why you don't get the validate exception there.

[1] xml
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/WsdlFirstBeans.xml
[2] test
https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfWsdlFirstTest.java

Willem

Daniel Pike wrote:
> I am currently trying to implement a CXF endpoint to receive messages
> based on a wsdl specification, route the message through a number of beans
> and xml transformations and then return the message as a SOAP response.
> This all seems to be working except I have been unable to get CXF to perform
> schema validation on the SOAP messages received.  In my spring application
> context, I have the CXF endpoint and camel context/route setup as below.
> <cxfEndpoint xmlns="http://activemq.apache.org/camel/schema/cxfEndpoint"
>                  id="serviceEndpoint"
>                  wsdlURL="META-INF/wsdl/service.wsdl"
>                  serviceClass="com.services.Service"
>                  address="/Service">
>         <properties>
>             <beans:entry key="schema-validation-enabled" value="true"/>
>         </properties>
> </cxfEndpoint>
> 
> <camelContext id="camelContext" xmlns="
> http://activemq.apache.org/camel/schema/spring">
>         <route>
>             <from uri="cxf:bean:serviceEndpoint"/>
>             <to uri="log:service"/>
>             <convertBodyTo type="java.lang.String"/>
>             <to uri="xslt:META-INF/xsl/messageTransformation.xsl"/>
>             <to uri="bean:messageSenderBean?methodName=sendMessage"/>
>         </route>
> </camelContext>
> 
> When I send a message to CXF in a format that does not comply to the schema
> defined in the WSDL, CXF does not perform the validation and the message
> passes through successfully.  Does anyone know why this might not be
> working?  Is there any way to perform schema validation using CXF and Camel?
> 
> Thanks
> 
> Dan.
>