You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Pieper, Aaron" <Pi...@Pragmatics.com> on 2010/12/14 18:46:49 UTC

Enabling jaxws schema validation through CXF?

Hello,

 

I am trying to enable incoming schema validation on a CXF endpoint. I
know this is a very common question. I am using CXF 2.3.0. I tried
adding the annotation to my web service, and I also tried the
"jaxws:properties" approach, modifying my cxf-servlet file. Both of
those approaches worked, kind of - but they only enable outgoing
validation. Incoming messages are still unvalidated, and I'm not sure
why.

 

I'm 90% sure the problem is on my side, so my real question is - is
there one of the code samples in CXF which I can easily tweak to enable
validation, so that I can see how it's supposed to work? Or are there
any of the examples which already have validation enabled? The closest
thing I could find was the wsdl-first examples, which are a little
broken I think.

 

The "wsdl_first_soap12" Client.java has a try/catch block which says
something along the lines of, "Invoking greetMe with invalid length
string, expecting exception..." but, the exception isn't thrown, and the
test passes anyways, since there's no "Assert.fail" in the try block.

 

I also looked at the "wsdl_first" project because its cxf.xml had the
jaxws validation tags in it. The wsdl_first project didn't work out of
the box, because the pom.xml file referenced a "hello_world.wsdl" which
didn't exist. After fixing that, though, schema validation is still not
enabled - it seems like the "mvn -Pserver" sidesteps the cxf.xml
configuration file, the endpoint is configured in the
CustomerServiceServer.java file.

 

What is the easiest way to get an example up and running with incoming
schema validation? I have been running most of the examples with the
"mvn -Pserver" approach which seems like it would not activate any of
the annotations or any of the CXF configuration files which trigger
validation. Do I have to modify one of the examples to enable XSD
validation, launch a standalone tomcat instance, build a war file, and
deploy the war file into that instance? Or is there a simpler way?

 

Thanks,

 

- Aaron

 


RE: Enabling jaxws schema validation through CXF?

Posted by "Pieper, Aaron" <Pi...@Pragmatics.com>.
That's great, thanks Daniel!

- Aaron


-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Tuesday, December 14, 2010 3:38 PM
To: users@cxf.apache.org
Cc: Pieper, Aaron
Subject: Re: Enabling jaxws schema validation through CXF?


Thanks for the report.   I just fixed the wsdl_first_soap12 to properly 
validate with the -Pserver flag.    The key was the  log entry of:

Creating Service {http://apache.org/hello_world_soap12_http}SOAPService
from 
class ......

instead of saying "from WSDL".   The way it was being started, it wasn't
using 
the wsdl so it couldn't really validate.   I've changed how it's started
and 
added the new @SchemaValidation annotation an it now works.  You can
grab it 
all from:
http://svn.apache.org/repos/asf/cxf/trunk/distribution/src/main/release/
samples/wsdl_first_soap12/
if you want.

Dan


On Tuesday 14 December 2010 12:46:49 pm Pieper, Aaron wrote:
> Hello,
> 
> 
> 
> I am trying to enable incoming schema validation on a CXF endpoint. I
> know this is a very common question. I am using CXF 2.3.0. I tried
> adding the annotation to my web service, and I also tried the
> "jaxws:properties" approach, modifying my cxf-servlet file. Both of
> those approaches worked, kind of - but they only enable outgoing
> validation. Incoming messages are still unvalidated, and I'm not sure
> why.
> 
> 
> 
> I'm 90% sure the problem is on my side, so my real question is - is
> there one of the code samples in CXF which I can easily tweak to
enable
> validation, so that I can see how it's supposed to work? Or are there
> any of the examples which already have validation enabled? The closest
> thing I could find was the wsdl-first examples, which are a little
> broken I think.
> 
> 
> 
> The "wsdl_first_soap12" Client.java has a try/catch block which says
> something along the lines of, "Invoking greetMe with invalid length
> string, expecting exception..." but, the exception isn't thrown, and
the
> test passes anyways, since there's no "Assert.fail" in the try block.
> 
> 
> 
> I also looked at the "wsdl_first" project because its cxf.xml had the
> jaxws validation tags in it. The wsdl_first project didn't work out of
> the box, because the pom.xml file referenced a "hello_world.wsdl"
which
> didn't exist. After fixing that, though, schema validation is still
not
> enabled - it seems like the "mvn -Pserver" sidesteps the cxf.xml
> configuration file, the endpoint is configured in the
> CustomerServiceServer.java file.
> 
> 
> 
> What is the easiest way to get an example up and running with incoming
> schema validation? I have been running most of the examples with the
> "mvn -Pserver" approach which seems like it would not activate any of
> the annotations or any of the CXF configuration files which trigger
> validation. Do I have to modify one of the examples to enable XSD
> validation, launch a standalone tomcat instance, build a war file, and
> deploy the war file into that instance? Or is there a simpler way?
> 
> 
> 
> Thanks,
> 
> 
> 
> - Aaron

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Enabling jaxws schema validation through CXF?

Posted by Daniel Kulp <dk...@apache.org>.
Thanks for the report.   I just fixed the wsdl_first_soap12 to properly 
validate with the -Pserver flag.    The key was the  log entry of:

Creating Service {http://apache.org/hello_world_soap12_http}SOAPService from 
class ......

instead of saying "from WSDL".   The way it was being started, it wasn't using 
the wsdl so it couldn't really validate.   I've changed how it's started and 
added the new @SchemaValidation annotation an it now works.  You can grab it 
all from:
http://svn.apache.org/repos/asf/cxf/trunk/distribution/src/main/release/samples/wsdl_first_soap12/
if you want.

Dan


On Tuesday 14 December 2010 12:46:49 pm Pieper, Aaron wrote:
> Hello,
> 
> 
> 
> I am trying to enable incoming schema validation on a CXF endpoint. I
> know this is a very common question. I am using CXF 2.3.0. I tried
> adding the annotation to my web service, and I also tried the
> "jaxws:properties" approach, modifying my cxf-servlet file. Both of
> those approaches worked, kind of - but they only enable outgoing
> validation. Incoming messages are still unvalidated, and I'm not sure
> why.
> 
> 
> 
> I'm 90% sure the problem is on my side, so my real question is - is
> there one of the code samples in CXF which I can easily tweak to enable
> validation, so that I can see how it's supposed to work? Or are there
> any of the examples which already have validation enabled? The closest
> thing I could find was the wsdl-first examples, which are a little
> broken I think.
> 
> 
> 
> The "wsdl_first_soap12" Client.java has a try/catch block which says
> something along the lines of, "Invoking greetMe with invalid length
> string, expecting exception..." but, the exception isn't thrown, and the
> test passes anyways, since there's no "Assert.fail" in the try block.
> 
> 
> 
> I also looked at the "wsdl_first" project because its cxf.xml had the
> jaxws validation tags in it. The wsdl_first project didn't work out of
> the box, because the pom.xml file referenced a "hello_world.wsdl" which
> didn't exist. After fixing that, though, schema validation is still not
> enabled - it seems like the "mvn -Pserver" sidesteps the cxf.xml
> configuration file, the endpoint is configured in the
> CustomerServiceServer.java file.
> 
> 
> 
> What is the easiest way to get an example up and running with incoming
> schema validation? I have been running most of the examples with the
> "mvn -Pserver" approach which seems like it would not activate any of
> the annotations or any of the CXF configuration files which trigger
> validation. Do I have to modify one of the examples to enable XSD
> validation, launch a standalone tomcat instance, build a war file, and
> deploy the war file into that instance? Or is there a simpler way?
> 
> 
> 
> Thanks,
> 
> 
> 
> - Aaron

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

RE: Enabling jaxws schema validation through CXF?

Posted by "Pieper, Aaron" <Pi...@Pragmatics.com>.
Yes, you're right, this works fine in CXF 2.3.1. I won't bother
submitting a tracker.

- Aaron


-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Thursday, December 16, 2010 2:40 PM
To: users@cxf.apache.org
Cc: Pieper, Aaron
Subject: Re: Enabling jaxws schema validation through CXF?


Actually, that behavior in DataReaderImpl was removed on Nov 17th.  See
the 
subversion tab at:
https://issues.apache.org/jira/browse/CXF-2868

Basically, the bug in JAXB that required the use of the bridge was fixed
in 
the latest JAXB versions that we now ship so that behavior was removed.

Thus, with CXF 2.3.1, the validation problem should be fine.

Dan



On Thursday 16 December 2010 2:34:28 pm Pieper, Aaron wrote:
> I've figured out more information about the CXF XSD validation
problems
> I was having.
> 
> After using Glen's "DoubleIt" example to demonstrate that incoming
> schema validation worked, I compared it to my project. It turns out
CXF
> was disabling incoming schema validation if any xs:dateTime parameters
> were declared. I traced this to the
> org.apache.cxf.jaxb.io.DataReaderImpl class. DataReaderImpl has a
> special case where, if the class being read has an
XMLGregorianCalendar
> field, then the object is unmarshalled in a different way, using the
> "unmarshalWithBridge" method instead of the "unmarshall" method. This
> unmarshalWithBridge method does not enforce XSD validation.
> 
> So, CXF's incoming XSD validation is quietly disabled for any services
> that accept an xs:dateTime. You can work around this by binding the
XML
> xs:dateTime type to a java.util.Date. After I applied this binding,
> inbound XSD validation worked OK.
> 
> This kind of behavior sets kind of a weird precedent for anybody who's
> counting on CXF's annotations for XSD validation. If XSD validation
can
> be accidentally disabled on a service-by-service basis, I guess that
> puts the responsibility on the developer to verify that inbound and
> outbound XSD validation is enabled for each individual service.
> 
> - Aaron
> 
> -----Original Message-----
> From: Pieper, Aaron [mailto:PieperA@Pragmatics.com]
> Sent: Tuesday, December 14, 2010 2:45 PM
> To: users@cxf.apache.org
> Subject: RE: Enabling jaxws schema validation through CXF?
> 
> Glen,
> 
> I initially had some trouble where Tomcat 6.0.20 was being finicky
> deploying the war file, but Tomcat 6.0.29 did a better job, and I was
> able to get your example up and running. I then modified the WSDL so
> that "numberToDouble" and "doubledNumber" have numeric constraints,
and
> it works, reporting incoming and outgoing validation errors properly.
I
> can now use this validation example as a reference, to figure out why
> validation isn't being enabled properly in my project.
> 
> Thanks!
> 
> - Aaron
> 
> 
> -----Original Message-----
> From: Glen Mazza [mailto:glen.mazza@gmail.com]
> Sent: Tuesday, December 14, 2010 12:58 PM
> To: users@cxf.apache.org
> Subject: Re: Enabling jaxws schema validation through CXF?
> 
> Hi Aaron -- might this blog entry help you:
> http://www.jroller.com/gmazza/entry/soap_xml_schema_validation
> 
> Regards,
> Glen
> 
> On 12/14/2010 12:46 PM, Pieper, Aaron wrote:
> > Hello,
> > 
> > 
> > 
> > I am trying to enable incoming schema validation on a CXF endpoint.
I
> > know this is a very common question. I am using CXF 2.3.0. I tried
> > adding the annotation to my web service, and I also tried the
> > "jaxws:properties" approach, modifying my cxf-servlet file. Both of
> > those approaches worked, kind of - but they only enable outgoing
> > validation. Incoming messages are still unvalidated, and I'm not
sure
> > why.
> > 
> > 
> > 
> > I'm 90% sure the problem is on my side, so my real question is - is
> > there one of the code samples in CXF which I can easily tweak to
> 
> enable
> 
> > validation, so that I can see how it's supposed to work? Or are
there
> > any of the examples which already have validation enabled? The
closest
> > thing I could find was the wsdl-first examples, which are a little
> > broken I think.
> > 
> > 
> > 
> > The "wsdl_first_soap12" Client.java has a try/catch block which says
> > something along the lines of, "Invoking greetMe with invalid length
> > string, expecting exception..." but, the exception isn't thrown, and
> 
> the
> 
> > test passes anyways, since there's no "Assert.fail" in the try
block.
> > 
> > 
> > 
> > I also looked at the "wsdl_first" project because its cxf.xml had
the
> > jaxws validation tags in it. The wsdl_first project didn't work out
of
> > the box, because the pom.xml file referenced a "hello_world.wsdl"
> 
> which
> 
> > didn't exist. After fixing that, though, schema validation is still
> 
> not
> 
> > enabled - it seems like the "mvn -Pserver" sidesteps the cxf.xml
> > configuration file, the endpoint is configured in the
> > CustomerServiceServer.java file.
> > 
> > 
> > 
> > What is the easiest way to get an example up and running with
incoming
> > schema validation? I have been running most of the examples with the
> > "mvn -Pserver" approach which seems like it would not activate any
of
> > the annotations or any of the CXF configuration files which trigger
> > validation. Do I have to modify one of the examples to enable XSD
> > validation, launch a standalone tomcat instance, build a war file,
and
> > deploy the war file into that instance? Or is there a simpler way?
> > 
> > 
> > 
> > Thanks,
> > 
> > 
> > 
> > - Aaron

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Enabling jaxws schema validation through CXF?

Posted by Daniel Kulp <dk...@apache.org>.
Actually, that behavior in DataReaderImpl was removed on Nov 17th.  See the 
subversion tab at:
https://issues.apache.org/jira/browse/CXF-2868

Basically, the bug in JAXB that required the use of the bridge was fixed in 
the latest JAXB versions that we now ship so that behavior was removed.   
Thus, with CXF 2.3.1, the validation problem should be fine.

Dan



On Thursday 16 December 2010 2:34:28 pm Pieper, Aaron wrote:
> I've figured out more information about the CXF XSD validation problems
> I was having.
> 
> After using Glen's "DoubleIt" example to demonstrate that incoming
> schema validation worked, I compared it to my project. It turns out CXF
> was disabling incoming schema validation if any xs:dateTime parameters
> were declared. I traced this to the
> org.apache.cxf.jaxb.io.DataReaderImpl class. DataReaderImpl has a
> special case where, if the class being read has an XMLGregorianCalendar
> field, then the object is unmarshalled in a different way, using the
> "unmarshalWithBridge" method instead of the "unmarshall" method. This
> unmarshalWithBridge method does not enforce XSD validation.
> 
> So, CXF's incoming XSD validation is quietly disabled for any services
> that accept an xs:dateTime. You can work around this by binding the XML
> xs:dateTime type to a java.util.Date. After I applied this binding,
> inbound XSD validation worked OK.
> 
> This kind of behavior sets kind of a weird precedent for anybody who's
> counting on CXF's annotations for XSD validation. If XSD validation can
> be accidentally disabled on a service-by-service basis, I guess that
> puts the responsibility on the developer to verify that inbound and
> outbound XSD validation is enabled for each individual service.
> 
> - Aaron
> 
> -----Original Message-----
> From: Pieper, Aaron [mailto:PieperA@Pragmatics.com]
> Sent: Tuesday, December 14, 2010 2:45 PM
> To: users@cxf.apache.org
> Subject: RE: Enabling jaxws schema validation through CXF?
> 
> Glen,
> 
> I initially had some trouble where Tomcat 6.0.20 was being finicky
> deploying the war file, but Tomcat 6.0.29 did a better job, and I was
> able to get your example up and running. I then modified the WSDL so
> that "numberToDouble" and "doubledNumber" have numeric constraints, and
> it works, reporting incoming and outgoing validation errors properly. I
> can now use this validation example as a reference, to figure out why
> validation isn't being enabled properly in my project.
> 
> Thanks!
> 
> - Aaron
> 
> 
> -----Original Message-----
> From: Glen Mazza [mailto:glen.mazza@gmail.com]
> Sent: Tuesday, December 14, 2010 12:58 PM
> To: users@cxf.apache.org
> Subject: Re: Enabling jaxws schema validation through CXF?
> 
> Hi Aaron -- might this blog entry help you:
> http://www.jroller.com/gmazza/entry/soap_xml_schema_validation
> 
> Regards,
> Glen
> 
> On 12/14/2010 12:46 PM, Pieper, Aaron wrote:
> > Hello,
> > 
> > 
> > 
> > I am trying to enable incoming schema validation on a CXF endpoint. I
> > know this is a very common question. I am using CXF 2.3.0. I tried
> > adding the annotation to my web service, and I also tried the
> > "jaxws:properties" approach, modifying my cxf-servlet file. Both of
> > those approaches worked, kind of - but they only enable outgoing
> > validation. Incoming messages are still unvalidated, and I'm not sure
> > why.
> > 
> > 
> > 
> > I'm 90% sure the problem is on my side, so my real question is - is
> > there one of the code samples in CXF which I can easily tweak to
> 
> enable
> 
> > validation, so that I can see how it's supposed to work? Or are there
> > any of the examples which already have validation enabled? The closest
> > thing I could find was the wsdl-first examples, which are a little
> > broken I think.
> > 
> > 
> > 
> > The "wsdl_first_soap12" Client.java has a try/catch block which says
> > something along the lines of, "Invoking greetMe with invalid length
> > string, expecting exception..." but, the exception isn't thrown, and
> 
> the
> 
> > test passes anyways, since there's no "Assert.fail" in the try block.
> > 
> > 
> > 
> > I also looked at the "wsdl_first" project because its cxf.xml had the
> > jaxws validation tags in it. The wsdl_first project didn't work out of
> > the box, because the pom.xml file referenced a "hello_world.wsdl"
> 
> which
> 
> > didn't exist. After fixing that, though, schema validation is still
> 
> not
> 
> > enabled - it seems like the "mvn -Pserver" sidesteps the cxf.xml
> > configuration file, the endpoint is configured in the
> > CustomerServiceServer.java file.
> > 
> > 
> > 
> > What is the easiest way to get an example up and running with incoming
> > schema validation? I have been running most of the examples with the
> > "mvn -Pserver" approach which seems like it would not activate any of
> > the annotations or any of the CXF configuration files which trigger
> > validation. Do I have to modify one of the examples to enable XSD
> > validation, launch a standalone tomcat instance, build a war file, and
> > deploy the war file into that instance? Or is there a simpler way?
> > 
> > 
> > 
> > Thanks,
> > 
> > 
> > 
> > - Aaron

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

RE: Enabling jaxws schema validation through CXF?

Posted by "Pieper, Aaron" <Pi...@Pragmatics.com>.
I've figured out more information about the CXF XSD validation problems
I was having.

After using Glen's "DoubleIt" example to demonstrate that incoming
schema validation worked, I compared it to my project. It turns out CXF
was disabling incoming schema validation if any xs:dateTime parameters
were declared. I traced this to the
org.apache.cxf.jaxb.io.DataReaderImpl class. DataReaderImpl has a
special case where, if the class being read has an XMLGregorianCalendar
field, then the object is unmarshalled in a different way, using the
"unmarshalWithBridge" method instead of the "unmarshall" method. This
unmarshalWithBridge method does not enforce XSD validation.

So, CXF's incoming XSD validation is quietly disabled for any services
that accept an xs:dateTime. You can work around this by binding the XML
xs:dateTime type to a java.util.Date. After I applied this binding,
inbound XSD validation worked OK.

This kind of behavior sets kind of a weird precedent for anybody who's
counting on CXF's annotations for XSD validation. If XSD validation can
be accidentally disabled on a service-by-service basis, I guess that
puts the responsibility on the developer to verify that inbound and
outbound XSD validation is enabled for each individual service.
 
- Aaron

-----Original Message-----
From: Pieper, Aaron [mailto:PieperA@Pragmatics.com] 
Sent: Tuesday, December 14, 2010 2:45 PM
To: users@cxf.apache.org
Subject: RE: Enabling jaxws schema validation through CXF?

Glen,

I initially had some trouble where Tomcat 6.0.20 was being finicky
deploying the war file, but Tomcat 6.0.29 did a better job, and I was
able to get your example up and running. I then modified the WSDL so
that "numberToDouble" and "doubledNumber" have numeric constraints, and
it works, reporting incoming and outgoing validation errors properly. I
can now use this validation example as a reference, to figure out why
validation isn't being enabled properly in my project.

Thanks!

- Aaron


-----Original Message-----
From: Glen Mazza [mailto:glen.mazza@gmail.com] 
Sent: Tuesday, December 14, 2010 12:58 PM
To: users@cxf.apache.org
Subject: Re: Enabling jaxws schema validation through CXF?

Hi Aaron -- might this blog entry help you:
http://www.jroller.com/gmazza/entry/soap_xml_schema_validation

Regards,
Glen

On 12/14/2010 12:46 PM, Pieper, Aaron wrote:
> Hello,
>
>
>
> I am trying to enable incoming schema validation on a CXF endpoint. I
> know this is a very common question. I am using CXF 2.3.0. I tried
> adding the annotation to my web service, and I also tried the
> "jaxws:properties" approach, modifying my cxf-servlet file. Both of
> those approaches worked, kind of - but they only enable outgoing
> validation. Incoming messages are still unvalidated, and I'm not sure
> why.
>
>
>
> I'm 90% sure the problem is on my side, so my real question is - is
> there one of the code samples in CXF which I can easily tweak to
enable
> validation, so that I can see how it's supposed to work? Or are there
> any of the examples which already have validation enabled? The closest
> thing I could find was the wsdl-first examples, which are a little
> broken I think.
>
>
>
> The "wsdl_first_soap12" Client.java has a try/catch block which says
> something along the lines of, "Invoking greetMe with invalid length
> string, expecting exception..." but, the exception isn't thrown, and
the
> test passes anyways, since there's no "Assert.fail" in the try block.
>
>
>
> I also looked at the "wsdl_first" project because its cxf.xml had the
> jaxws validation tags in it. The wsdl_first project didn't work out of
> the box, because the pom.xml file referenced a "hello_world.wsdl"
which
> didn't exist. After fixing that, though, schema validation is still
not
> enabled - it seems like the "mvn -Pserver" sidesteps the cxf.xml
> configuration file, the endpoint is configured in the
> CustomerServiceServer.java file.
>
>
>
> What is the easiest way to get an example up and running with incoming
> schema validation? I have been running most of the examples with the
> "mvn -Pserver" approach which seems like it would not activate any of
> the annotations or any of the CXF configuration files which trigger
> validation. Do I have to modify one of the examples to enable XSD
> validation, launch a standalone tomcat instance, build a war file, and
> deploy the war file into that instance? Or is there a simpler way?
>
>
>
> Thanks,
>
>
>
> - Aaron
>
>
>
>


RE: Enabling jaxws schema validation through CXF?

Posted by "Pieper, Aaron" <Pi...@Pragmatics.com>.
Glen,

I initially had some trouble where Tomcat 6.0.20 was being finicky
deploying the war file, but Tomcat 6.0.29 did a better job, and I was
able to get your example up and running. I then modified the WSDL so
that "numberToDouble" and "doubledNumber" have numeric constraints, and
it works, reporting incoming and outgoing validation errors properly. I
can now use this validation example as a reference, to figure out why
validation isn't being enabled properly in my project.

Thanks!

- Aaron


-----Original Message-----
From: Glen Mazza [mailto:glen.mazza@gmail.com] 
Sent: Tuesday, December 14, 2010 12:58 PM
To: users@cxf.apache.org
Subject: Re: Enabling jaxws schema validation through CXF?

Hi Aaron -- might this blog entry help you:
http://www.jroller.com/gmazza/entry/soap_xml_schema_validation

Regards,
Glen

On 12/14/2010 12:46 PM, Pieper, Aaron wrote:
> Hello,
>
>
>
> I am trying to enable incoming schema validation on a CXF endpoint. I
> know this is a very common question. I am using CXF 2.3.0. I tried
> adding the annotation to my web service, and I also tried the
> "jaxws:properties" approach, modifying my cxf-servlet file. Both of
> those approaches worked, kind of - but they only enable outgoing
> validation. Incoming messages are still unvalidated, and I'm not sure
> why.
>
>
>
> I'm 90% sure the problem is on my side, so my real question is - is
> there one of the code samples in CXF which I can easily tweak to
enable
> validation, so that I can see how it's supposed to work? Or are there
> any of the examples which already have validation enabled? The closest
> thing I could find was the wsdl-first examples, which are a little
> broken I think.
>
>
>
> The "wsdl_first_soap12" Client.java has a try/catch block which says
> something along the lines of, "Invoking greetMe with invalid length
> string, expecting exception..." but, the exception isn't thrown, and
the
> test passes anyways, since there's no "Assert.fail" in the try block.
>
>
>
> I also looked at the "wsdl_first" project because its cxf.xml had the
> jaxws validation tags in it. The wsdl_first project didn't work out of
> the box, because the pom.xml file referenced a "hello_world.wsdl"
which
> didn't exist. After fixing that, though, schema validation is still
not
> enabled - it seems like the "mvn -Pserver" sidesteps the cxf.xml
> configuration file, the endpoint is configured in the
> CustomerServiceServer.java file.
>
>
>
> What is the easiest way to get an example up and running with incoming
> schema validation? I have been running most of the examples with the
> "mvn -Pserver" approach which seems like it would not activate any of
> the annotations or any of the CXF configuration files which trigger
> validation. Do I have to modify one of the examples to enable XSD
> validation, launch a standalone tomcat instance, build a war file, and
> deploy the war file into that instance? Or is there a simpler way?
>
>
>
> Thanks,
>
>
>
> - Aaron
>
>
>
>


Re: Enabling jaxws schema validation through CXF?

Posted by Glen Mazza <gl...@gmail.com>.
Hi Aaron -- might this blog entry help you:
http://www.jroller.com/gmazza/entry/soap_xml_schema_validation

Regards,
Glen

On 12/14/2010 12:46 PM, Pieper, Aaron wrote:
> Hello,
>
>
>
> I am trying to enable incoming schema validation on a CXF endpoint. I
> know this is a very common question. I am using CXF 2.3.0. I tried
> adding the annotation to my web service, and I also tried the
> "jaxws:properties" approach, modifying my cxf-servlet file. Both of
> those approaches worked, kind of - but they only enable outgoing
> validation. Incoming messages are still unvalidated, and I'm not sure
> why.
>
>
>
> I'm 90% sure the problem is on my side, so my real question is - is
> there one of the code samples in CXF which I can easily tweak to enable
> validation, so that I can see how it's supposed to work? Or are there
> any of the examples which already have validation enabled? The closest
> thing I could find was the wsdl-first examples, which are a little
> broken I think.
>
>
>
> The "wsdl_first_soap12" Client.java has a try/catch block which says
> something along the lines of, "Invoking greetMe with invalid length
> string, expecting exception..." but, the exception isn't thrown, and the
> test passes anyways, since there's no "Assert.fail" in the try block.
>
>
>
> I also looked at the "wsdl_first" project because its cxf.xml had the
> jaxws validation tags in it. The wsdl_first project didn't work out of
> the box, because the pom.xml file referenced a "hello_world.wsdl" which
> didn't exist. After fixing that, though, schema validation is still not
> enabled - it seems like the "mvn -Pserver" sidesteps the cxf.xml
> configuration file, the endpoint is configured in the
> CustomerServiceServer.java file.
>
>
>
> What is the easiest way to get an example up and running with incoming
> schema validation? I have been running most of the examples with the
> "mvn -Pserver" approach which seems like it would not activate any of
> the annotations or any of the CXF configuration files which trigger
> validation. Do I have to modify one of the examples to enable XSD
> validation, launch a standalone tomcat instance, build a war file, and
> deploy the war file into that instance? Or is there a simpler way?
>
>
>
> Thanks,
>
>
>
> - Aaron
>
>
>
>