Re: Server returned HTTP response code: 403 for URL: http://www.w3.org/2001/datatypes.dtd for schema validation
One way is as follows, fetch all the remote wsdl/xsd/dtd's and drop them into your hard disk. Then edit all of them to make sure they don't refer to the remote url and switch them to the local copy. then run wsdl2java on it. thanks, dims On 06/12/2009 03:04 AM, Håkon Sagehaug wrote: HI I see the reason for why the error message came, but not what I can do as a ws developer. I either have to ask if there can be installed a web cache in front of our servlet engine, or there I guess have to be some cache or option to say to axis that, it should look for the files locally. Or is there more options? Also to me it looks like axis is getting all nedded schemas when a wsdl2java is runned. cheers, Håkon 2009/6/11 Davanum Srinivasdava...@gmail.com Håkon, FYI, http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic -- dims On 06/11/2009 11:56 AM, Håkon Sagehaug wrote: Hi all I got an exception today when I wanted to deploy a web service, the exception was as following [INFO] Trouble processing wsdl file :WSDLException (at /wsdl:definitions/wsdl:types/xs:schema/xs:schema/xsd:schema): faultCode=PARSER_ERROR: Problem parsing ' http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd'http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd%27 .: java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.w3.org/2001/datatypes.dtd It seems that the url does not allow one to open a stream to it, this program gets the same error URL url = new URL(http://www.w3.org/2001/datatypes.dtd;); InputStream is = url.openStream(); There has been a discussion on the Tuscany list [1] Is it the same issue in axis 2, I use version 1.4.1 cheers, Håkon [1] http://mail-archives.apache.org/mod_mbox/tuscany-dev/200906.mbox/%3c8765ca4ebd4d4618a67a8a4bc2b02...@rfengt61p%3e
Server returned HTTP response code: 403 for URL: http://www.w3.org/2001/datatypes.dtd for schema validation
Hi all I got an exception today when I wanted to deploy a web service, the exception was as following [INFO] Trouble processing wsdl file :WSDLException (at /wsdl:definitions/wsdl:types/xs:schema/xs:schema/xsd:schema): faultCode=PARSER_ERROR: Problem parsing ' http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd'.: java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.w3.org/2001/datatypes.dtd It seems that the url does not allow one to open a stream to it, this program gets the same error URL url = new URL(http://www.w3.org/2001/datatypes.dtd;); InputStream is = url.openStream(); There has been a discussion on the Tuscany list [1] Is it the same issue in axis 2, I use version 1.4.1 cheers, Håkon [1] http://mail-archives.apache.org/mod_mbox/tuscany-dev/200906.mbox/%3c8765ca4ebd4d4618a67a8a4bc2b02...@rfengt61p%3e -- Håkon Sagehaug, Scientific Programmer Parallab, Bergen Center for Computational Science (BCCS) UNIFOB AS (University of Bergen Research Company)
Re: Server returned HTTP response code: 403 for URL: http://www.w3.org/2001/datatypes.dtd for schema validation
Håkon, FYI, http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic -- dims On 06/11/2009 11:56 AM, Håkon Sagehaug wrote: Hi all I got an exception today when I wanted to deploy a web service, the exception was as following [INFO] Trouble processing wsdl file :WSDLException (at /wsdl:definitions/wsdl:types/xs:schema/xs:schema/xsd:schema): faultCode=PARSER_ERROR: Problem parsing ' http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd'.: java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.w3.org/2001/datatypes.dtd It seems that the url does not allow one to open a stream to it, this program gets the same error URL url = new URL(http://www.w3.org/2001/datatypes.dtd;); InputStream is = url.openStream(); There has been a discussion on the Tuscany list [1] Is it the same issue in axis 2, I use version 1.4.1 cheers, Håkon [1] http://mail-archives.apache.org/mod_mbox/tuscany-dev/200906.mbox/%3c8765ca4ebd4d4618a67a8a4bc2b02...@rfengt61p%3e
Re: [axis2] Automatic schema validation
Cool. Nice handler Dennis. Both the Synapse schema validator and Dennis's MAR both suffer from being a little too simple - you need to specify the schema. I think it would be great to have them both work from the WSDL. Maybe we could join forces to create a single piece of code that takes a message+wsdl and validates and then it can be a separate MAR and a Synapse mediator. Thoughts? Paul On Thu, Oct 2, 2008 at 9:28 PM, Dennis Sosnoski [EMAIL PROTECTED] wrote: Hi Jake, I wrote a handler for schema validation some time ago, as an example for my training classes. Here's the information on it: http://www.sosnoski.com/jibx-wiki/space/axis2-jibx/validation - Dennis -- Dennis M. Sosnoski SOA and Web Services in Java Axis2 Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Jake Goulding wrote: Paul: Thanks for the information. However, I think your example went over my head a bit. I have a WSDL that has 4 or so XSD schemas. I point wsdl2java at that WSDL, then write an extremely simple driver program that calls the Axis2 stubs. Is there a way to basically point Synapse at the same WSDL and then add a few lines of code to my driver program that will instruct Axis to use Synapse to validate the incoming message? Thanks! -Jake Paul Fremantle wrote: Jake Synapse (http://synapse.apache.org) can be used to add Schema Validation to Axis2 - either in the handler chain or as a standalone gateway/security process. See http://synapse.apache.org/Synapse_Samples.html#Sample7 Paul On Thu, Oct 2, 2008 at 6:11 PM, Deepal Jayasinghe [EMAIL PROTECTED] wrote: Deepal: Thanks for the quick answer (most of my other email to list seems to get ignored ;-)). I am sorry for that , if I see any mail that I can answer I will do my best,. I'm sure that schema validation would slow down the system, potentially a lot, but this would be invaluable for people operating with systems outside of their control. There is also a great quote that I cannot seem to find now, but it goes along the lines of how important is it to get the wrong answer quickly? Do you have any pointers to help me write the handler that you suggest? For further reference, I am writing a client based on JAXB, using Axis2 1.4.1. http://www.developer.com/java/web/article.php/3529321 http://www.packtpub.com/article/handler-and-phase-in-apache-axis Thank you! Deepal Thanks! -Jake Deepal jayasinghe wrote: Answers is no , because it slow down the system. However you can implement that your own. Just need to write a handler :) -Deepal Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thank you! http://blogs.deepal.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Paul Fremantle Co-Founder and CTO, WSO2 Apache Synapse PMC Chair OASIS WS-RX TC Co-chair blog: http://pzf.fremantle.org [EMAIL PROTECTED] Oxygenating the Web Service Platform, www.wso2.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] Automatic schema validation
It'd be great to have a validation option as part of the standard Axis2 distribution, and working from the WSDL would probably be the most convenient approach from the user standpoint. I haven't looked into the Synapse validator code - do you think that would be a better basis for this than what I've got? If you think mine is good I can set it up as a maven module and commit it to the Axis2 source code, then we can look into adding the WSDL support. - Dennis Paul Fremantle wrote: Cool. Nice handler Dennis. Both the Synapse schema validator and Dennis's MAR both suffer from being a little too simple - you need to specify the schema. I think it would be great to have them both work from the WSDL. Maybe we could join forces to create a single piece of code that takes a message+wsdl and validates and then it can be a separate MAR and a Synapse mediator. Thoughts? Paul On Thu, Oct 2, 2008 at 9:28 PM, Dennis Sosnoski [EMAIL PROTECTED] wrote: Hi Jake, I wrote a handler for schema validation some time ago, as an example for my training classes. Here's the information on it: http://www.sosnoski.com/jibx-wiki/space/axis2-jibx/validation - Dennis -- Dennis M. Sosnoski SOA and Web Services in Java Axis2 Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Jake Goulding wrote: Paul: Thanks for the information. However, I think your example went over my head a bit. I have a WSDL that has 4 or so XSD schemas. I point wsdl2java at that WSDL, then write an extremely simple driver program that calls the Axis2 stubs. Is there a way to basically point Synapse at the same WSDL and then add a few lines of code to my driver program that will instruct Axis to use Synapse to validate the incoming message? Thanks! -Jake Paul Fremantle wrote: Jake Synapse (http://synapse.apache.org) can be used to add Schema Validation to Axis2 - either in the handler chain or as a standalone gateway/security process. See http://synapse.apache.org/Synapse_Samples.html#Sample7 Paul On Thu, Oct 2, 2008 at 6:11 PM, Deepal Jayasinghe [EMAIL PROTECTED] wrote: Deepal: Thanks for the quick answer (most of my other email to list seems to get ignored ;-)). I am sorry for that , if I see any mail that I can answer I will do my best,. I'm sure that schema validation would slow down the system, potentially a lot, but this would be invaluable for people operating with systems outside of their control. There is also a great quote that I cannot seem to find now, but it goes along the lines of how important is it to get the wrong answer quickly? Do you have any pointers to help me write the handler that you suggest? For further reference, I am writing a client based on JAXB, using Axis2 1.4.1. http://www.developer.com/java/web/article.php/3529321 http://www.packtpub.com/article/handler-and-phase-in-apache-axis Thank you! Deepal Thanks! -Jake Deepal jayasinghe wrote: Answers is no , because it slow down the system. However you can implement that your own. Just need to write a handler :) -Deepal Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thank you! http://blogs.deepal.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[axis2] Automatic schema validation
Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] Automatic schema validation
Answers is no , because it slow down the system. However you can implement that your own. Just need to write a handler :) -Deepal Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thank you! http://blogs.deepal.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] Automatic schema validation
Deepal: Thanks for the quick answer (most of my other email to list seems to get ignored ;-)). I'm sure that schema validation would slow down the system, potentially a lot, but this would be invaluable for people operating with systems outside of their control. There is also a great quote that I cannot seem to find now, but it goes along the lines of how important is it to get the wrong answer quickly? Do you have any pointers to help me write the handler that you suggest? For further reference, I am writing a client based on JAXB, using Axis2 1.4.1. Thanks! -Jake Deepal jayasinghe wrote: Answers is no , because it slow down the system. However you can implement that your own. Just need to write a handler :) -Deepal Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [axis2] Automatic schema validation
Hi Deepal, I have the same question for both provisioning and consuming services, and we are using ADB. Thanks, Jennifer -Original Message- From: Jake Goulding [mailto:[EMAIL PROTECTED] Sent: Thursday, Oct 02, 2008 11:37 AM To: axis-user@ws.apache.org Subject: Re: [axis2] Automatic schema validation Deepal: Thanks for the quick answer (most of my other email to list seems to get ignored ;-)). I'm sure that schema validation would slow down the system, potentially a lot, but this would be invaluable for people operating with systems outside of their control. There is also a great quote that I cannot seem to find now, but it goes along the lines of how important is it to get the wrong answer quickly? Do you have any pointers to help me write the handler that you suggest? For further reference, I am writing a client based on JAXB, using Axis2 1.4.1. Thanks! -Jake Deepal jayasinghe wrote: Answers is no , because it slow down the system. However you can implement that your own. Just need to write a handler :) -Deepal Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] Automatic schema validation
I think you would get some form of validation if you use generated code on the server. i.e If a message is sent with a missing element the MessageReceiver will detect this and throw a fault. Also this comes without any additional cost. It will also check minoccurs and nillable attributes. Thanks, Keith. On Thu, Oct 2, 2008 at 8:45 PM, Jake Goulding [EMAIL PROTECTED] wrote: Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Keith Chapman Senior Software Engineer WSO2 Inc. Oxygenating the Web Service Platform. http://wso2.org/ blog: http://www.keith-chapman.org
Re: [axis2] Automatic schema validation
Deepal: Thanks for the quick answer (most of my other email to list seems to get ignored ;-)). I am sorry for that , if I see any mail that I can answer I will do my best,. I'm sure that schema validation would slow down the system, potentially a lot, but this would be invaluable for people operating with systems outside of their control. There is also a great quote that I cannot seem to find now, but it goes along the lines of how important is it to get the wrong answer quickly? Do you have any pointers to help me write the handler that you suggest? For further reference, I am writing a client based on JAXB, using Axis2 1.4.1. http://www.developer.com/java/web/article.php/3529321 http://www.packtpub.com/article/handler-and-phase-in-apache-axis Thank you! Deepal Thanks! -Jake Deepal jayasinghe wrote: Answers is no , because it slow down the system. However you can implement that your own. Just need to write a handler :) -Deepal Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thank you! http://blogs.deepal.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [LIKELY JUNK]Re: [axis2] Automatic schema validation
I did some testing, for ADB beans, most of the validations are there, but it's not complete. At least decimal precision is NOT validated. Do you have an example of writing a handler to validate the xml message against a WSDL file? Thanks, Jennifer From: keith chapman [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2008 12:35 PM To: axis-user@ws.apache.org Subject: [LIKELY JUNK]Re: [axis2] Automatic schema validation I think you would get some form of validation if you use generated code on the server. i.e If a message is sent with a missing element the MessageReceiver will detect this and throw a fault. Also this comes without any additional cost. It will also check minoccurs and nillable attributes. Thanks, Keith. On Thu, Oct 2, 2008 at 8:45 PM, Jake Goulding [EMAIL PROTECTED] wrote: Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Keith Chapman Senior Software Engineer WSO2 Inc. Oxygenating the Web Service Platform. http://wso2.org/ blog: http://www.keith-chapman.org
Re: [LIKELY JUNK]Re: [axis2] Automatic schema validation
Jennifer Actually in the doc/lit case it would be pretty easy to validate against the WSDL, but in general its a bit harder. Synapse already does validation if you are willing to specify the XSD. It would be fairly simple to extend that to validate using the WSDL - as long as its doc/lit. Paul On Thu, Oct 2, 2008 at 6:09 PM, Chen, Jennifer [EMAIL PROTECTED] wrote: I did some testing, for ADB beans, most of the validations are there, but it's not complete. At least decimal precision is NOT validated. Do you have an example of writing a handler to validate the xml message against a WSDL file? Thanks, Jennifer From: keith chapman [mailto:[EMAIL PROTECTED] Sent: Thursday, October 02, 2008 12:35 PM To: axis-user@ws.apache.org Subject: [LIKELY JUNK]Re: [axis2] Automatic schema validation I think you would get some form of validation if you use generated code on the server. i.e If a message is sent with a missing element the MessageReceiver will detect this and throw a fault. Also this comes without any additional cost. It will also check minoccurs and nillable attributes. Thanks, Keith. On Thu, Oct 2, 2008 at 8:45 PM, Jake Goulding [EMAIL PROTECTED] wrote: Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Keith Chapman Senior Software Engineer WSO2 Inc. Oxygenating the Web Service Platform. http://wso2.org/ blog: http://www.keith-chapman.org -- Paul Fremantle Co-Founder and CTO, WSO2 Apache Synapse PMC Chair OASIS WS-RX TC Co-chair blog: http://pzf.fremantle.org [EMAIL PROTECTED] Oxygenating the Web Service Platform, www.wso2.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] Automatic schema validation
Paul: Thanks for the information. However, I think your example went over my head a bit. I have a WSDL that has 4 or so XSD schemas. I point wsdl2java at that WSDL, then write an extremely simple driver program that calls the Axis2 stubs. Is there a way to basically point Synapse at the same WSDL and then add a few lines of code to my driver program that will instruct Axis to use Synapse to validate the incoming message? Thanks! -Jake Paul Fremantle wrote: Jake Synapse (http://synapse.apache.org) can be used to add Schema Validation to Axis2 - either in the handler chain or as a standalone gateway/security process. See http://synapse.apache.org/Synapse_Samples.html#Sample7 Paul On Thu, Oct 2, 2008 at 6:11 PM, Deepal Jayasinghe [EMAIL PROTECTED] wrote: Deepal: Thanks for the quick answer (most of my other email to list seems to get ignored ;-)). I am sorry for that , if I see any mail that I can answer I will do my best,. I'm sure that schema validation would slow down the system, potentially a lot, but this would be invaluable for people operating with systems outside of their control. There is also a great quote that I cannot seem to find now, but it goes along the lines of how important is it to get the wrong answer quickly? Do you have any pointers to help me write the handler that you suggest? For further reference, I am writing a client based on JAXB, using Axis2 1.4.1. http://www.developer.com/java/web/article.php/3529321 http://www.packtpub.com/article/handler-and-phase-in-apache-axis Thank you! Deepal Thanks! -Jake Deepal jayasinghe wrote: Answers is no , because it slow down the system. However you can implement that your own. Just need to write a handler :) -Deepal Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thank you! http://blogs.deepal.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [axis2] Automatic schema validation
The Axis2 soap monitor module is a perfect example on how to write a handler. Just download the code from http://ws.apache.org/axis2/modules/index.html and you'll be able make the monitor work within half an hour. Then the monitor module can be easily customized for schema validation, I believe. http://ws.apache.org/axis2/1_4/soapmonitor-module.html -richard -Original Message- From: Deepal Jayasinghe [mailto:[EMAIL PROTECTED] Sent: October 2, 2008 2:12 PM To: axis-user@ws.apache.org Subject: Re: [axis2] Automatic schema validation Deepal: Thanks for the quick answer (most of my other email to list seems to get ignored ;-)). I am sorry for that , if I see any mail that I can answer I will do my best,. I'm sure that schema validation would slow down the system, potentially a lot, but this would be invaluable for people operating with systems outside of their control. There is also a great quote that I cannot seem to find now, but it goes along the lines of how important is it to get the wrong answer quickly? Do you have any pointers to help me write the handler that you suggest? For further reference, I am writing a client based on JAXB, using Axis2 1.4.1. http://www.developer.com/java/web/article.php/3529321 http://www.packtpub.com/article/handler-and-phase-in-apache-axis Thank you! Deepal Thanks! -Jake Deepal jayasinghe wrote: Answers is no , because it slow down the system. However you can implement that your own. Just need to write a handler :) -Deepal Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thank you! http://blogs.deepal.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] Automatic schema validation
Hi Jake, I wrote a handler for schema validation some time ago, as an example for my training classes. Here's the information on it: http://www.sosnoski.com/jibx-wiki/space/axis2-jibx/validation - Dennis -- Dennis M. Sosnoski SOA and Web Services in Java Axis2 Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Jake Goulding wrote: Paul: Thanks for the information. However, I think your example went over my head a bit. I have a WSDL that has 4 or so XSD schemas. I point wsdl2java at that WSDL, then write an extremely simple driver program that calls the Axis2 stubs. Is there a way to basically point Synapse at the same WSDL and then add a few lines of code to my driver program that will instruct Axis to use Synapse to validate the incoming message? Thanks! -Jake Paul Fremantle wrote: Jake Synapse (http://synapse.apache.org) can be used to add Schema Validation to Axis2 - either in the handler chain or as a standalone gateway/security process. See http://synapse.apache.org/Synapse_Samples.html#Sample7 Paul On Thu, Oct 2, 2008 at 6:11 PM, Deepal Jayasinghe [EMAIL PROTECTED] wrote: Deepal: Thanks for the quick answer (most of my other email to list seems to get ignored ;-)). I am sorry for that , if I see any mail that I can answer I will do my best,. I'm sure that schema validation would slow down the system, potentially a lot, but this would be invaluable for people operating with systems outside of their control. There is also a great quote that I cannot seem to find now, but it goes along the lines of how important is it to get the wrong answer quickly? Do you have any pointers to help me write the handler that you suggest? For further reference, I am writing a client based on JAXB, using Axis2 1.4.1. http://www.developer.com/java/web/article.php/3529321 http://www.packtpub.com/article/handler-and-phase-in-apache-axis Thank you! Deepal Thanks! -Jake Deepal jayasinghe wrote: Answers is no , because it slow down the system. However you can implement that your own. Just need to write a handler :) -Deepal Hey all: Is there any way to have Axis automatically check the incoming (and potentially the outgoing) XML against the schema(s) originally provided in the WSDL? I did a search online, but didn't see anything that seems too likely. Thanks! -Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thank you! http://blogs.deepal.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Option to Remove Strict Schema Validation
The latest version of ADB no longer imposes the limitations described in the documentation. It offers pretty comprehensive support for XML Schema now. Anne On Tue, Sep 2, 2008 at 2:53 PM, Peter Conrey [EMAIL PROTECTED] wrote: I have been developing web services and web service clients in a large corporate environment for several years now. We employed several Perl web services (using SOAP::Lite) to feed both Java-based web clients (using Axis 1) and .NET clients in other departments. While the architecture works very well, we've run into a very frustrating scenario that limits our ability to respond quickly to change requests. Whenever we need to add data to a web service (say, a new field to a customer profile object), we have to completely re-deploy any Java application that uses that service/object, even if that new field is not relevant to the application. When we discovered that Axis 2 provided a means of turning off strict schema validation, we were excited to covert our code. However, according to the Axis documentation, the only client format that supports the -Eosv option is ADB, which also carries the following limitation: It is not meant to be a full schema binding application, and has difficulty with structures such as XML Schema element extensions and restrictions. --http://ws.apache.org/axis2/1_4/userguide-creatingclients.html#createclients Unfortunately, we use both extensions and restrictions in our schema, as they best define our data structure. How difficult would it be to add the Eosv option (or equivalent) to all data binding formats? As much as I hate to tout Microsoft, .NET has no such limitation, so adding information to serialized objects has no effect on .NET clients. While this may not be the correct behavior from a strict standards-based perspective, from a practical, enterprise perspective, it is unacceptable to have to rebuild 8-10 client applications just to support a change required only by one or two, especially when one of the unaffected applications is beyond the service developer's control. Has anyone else discovered a solution to this issue, or found a way around it? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Option to Remove Strict Schema Validation
I have been developing web services and web service clients in a large corporate environment for several years now. We employed several Perl web services (using SOAP::Lite) to feed both Java-based web clients (using Axis 1) and .NET clients in other departments. While the architecture works very well, we¹ve run into a very frustrating scenario that limits our ability to respond quickly to change requests. Whenever we need to add data to a web service (say, a new field to a customer profile object), we have to completely re-deploy any Java application that uses that service/object, even if that new field is not relevant to the application. When we discovered that Axis 2 provided a means of turning off strict schema validation, we were excited to covert our code. However, according to the Axis documentation, the only client format that supports the ³-Eosv² option is ADB, which also carries the following limitation: ³It is not meant to be a full schema binding application, and has difficulty with structures such as XML Schema element extensions and restrictions.² --http://ws.apache.org/axis2/1_4/userguide-creatingclients.html#createclient s Unfortunately, we use both extensions and restrictions in our schema, as they best define our data structure. How difficult would it be to add the ³Eosv² option (or equivalent) to all data binding formats? As much as I hate to tout Microsoft, .NET has no such limitation, so adding information to serialized objects has no effect on .NET clients. While this may not be the ³correct² behavior from a strict standards-based perspective, from a practical, enterprise perspective, it is unacceptable to have to rebuild 8-10 client applications just to support a change required only by one or two, especially when one of the unaffected applications is beyond the service developer¹s control. Has anyone else discovered a solution to this issue, or found a way around it?
Re: Option to Remove Strict Schema Validation
Title: Option to Remove Strict Schema Validation Hi Peter, I strictly use XML Beans as the data-binding for all my contract-first web services in Axis 2, and have actually had quite a few problems due to lack of schema validation. That is, unless we specifically validate the XML Beans DOM and throw an error, Axis 2/XML Beans doesn't validate against the schema. Peter Conrey wrote: I have been developing web services and web service clients in a large corporate environment for several years now. We employed several Perl web services (using SOAP::Lite) to feed both Java-based web clients (using Axis 1) and .NET clients in other departments. While the architecture works very well, weve run into a very frustrating scenario that limits our ability to respond quickly to change requests. Whenever we need to add data to a web service (say, a new field to a customer profile object), we have to completely re-deploy any Java application that uses that service/object, even if that new field is not relevant to the application. When we discovered that Axis 2 provided a means of turning off strict schema validation, we were excited to covert our code. However, according to the Axis documentation, the only client format that supports the -Eosv option is ADB, which also carries the following limitation: It is not meant to be a full schema binding application, and has difficulty with structures such as XML Schema element extensions and restrictions. --http://ws.apache.org/axis2/1_4/userguide-creatingclients.html#createclients Unfortunately, we use both extensions and restrictions in our schema, as they best define our data structure. How difficult would it be to add the Eosv option (or equivalent) to all data binding formats? As much as I hate to tout Microsoft, .NET has no such limitation, so adding information to serialized objects has no effect on .NET clients. While this may not be the correct behavior from a strict standards-based perspective, from a practical, enterprise perspective, it is unacceptable to have to rebuild 8-10 client applications just to support a change required only by one or two, especially when one of the unaffected applications is beyond the service developers control. Has anyone else discovered a solution to this issue, or found a way around it? -- Anthony - Anthony Bull Senior Developer Black Coffee Software Ltd PO Box 10-192 The Terrace Wellington, New Zealand [EMAIL PROTECTED] Ph +64 4 472 8818 Fax +64 4 472 8811 - www.bcsoft.co.nz --- This email may contain confidential or privileged information, and is intended for use only by the addressee, or addressees. If you are not the intended recipient please advise the sender immediately and do not copy, use or disclose the contents to any other person or organisation. Black Coffee Software Ltd accepts no responsibility for viruses received with this email, or to any changes made to the original content. Any views or opinions expressed in this email may be personal to the sender and are not necessarily those of Black Coffee Software Ltd. --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Turning off Schema validation in Axis2 1.3
I found the solution by hacking the client stub code by replacing the Exception int parse-method throw new org.apache.axis2.databinding.ADBException( Unexpected subelement + reader.getLocalName()); with object.setSalesorder_response(Msg_salesorder_soap_responseType.Factory.p arse(reader)); = The resulting POJO is still created right ! /S From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 4. huhtikuuta 2008 10:53 To: axis-user@ws.apache.org Subject: Turning off Schema validation in Axis2 1.3 Hello There has been quite a lot discussion of schema validation in Axis2 and I have understood that omitting validation is possible only in JIXB model or how would it be possibe with ADB ? It would be nice to bybass validation in runtime but generation time is enough. I now use version Axis2 1.3 br. Sakari
Turning off Schema validation in Axis2 1.3
Hello There has been quite a lot discussion of schema validation in Axis2 and I have understood that omitting validation is possible only in JIXB model or how would it be possibe with ADB ? It would be nice to bybass validation in runtime but generation time is enough. I now use version Axis2 1.3 br. Sakari
[Axis2] schema validation exception
I am getting an UnsupportedOperation Exception each time I try to validate an OMElement against a schema. I am using Axis2 1.2 with no data binding so my service class receives an OMElement object. The validation code is quite simple: // Get XML stream reader from OMElement received XMLStreamReader reader = doc.getXMLStreamReader(); //Create the DOOM OMFactory OMFactory doomFactory = DOOMAbstractFactory.getOMFactory(); //Create the new builder StAXOMBuilder doomBuilder = new StAXOMBuilder(doomFactory, reader); //Get the document element OMElement omElem = doomBuilder.getDocumentElement(); try { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema xsd = factory.newSchema(schemaLocation); Validator validator = xsd.newValidator(); validator.validate(new DOMSource((Element) omElem)); return true; } catch (Exception e) { return false; } Below is a snippet of the stack trace: java.lang.UnsupportedOperationException: TODO at org.apache.axiom.om.impl.dom.DocumentImpl.getDoctype(DocumentImpl.java:225) at org.apache.xerces.jaxp.validation.DOMValidatorHelper.setupEntityMap(Unknown Source) at org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown Source) at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source) at javax.xml.validation.Validator.validate(Unknown Source) Note that this works fine in Tomcat 5.5 but chokes in Websphere 6.1 so I suspect there is a class loading issue somewhere. What could be the problem?? Thanks, T - Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us.
Re: [Axis2] schema validation exception
For your websphere environment check the version of axiom jar (assume axiom-api-1.1.1.jar) check the version of Xerces (assume version 2.8.0 xercesImpl.jar) in either case I would copy the 2 good jars to your webspere deployment library folder HTH M-- - Original Message - From: Jack Sprat To: axis-user@ws.apache.org Sent: Monday, September 24, 2007 12:53 PM Subject: [Axis2] schema validation exception I am getting an UnsupportedOperation Exception each time I try to validate an OMElement against a schema. I am using Axis2 1.2 with no data binding so my service class receives an OMElement object. The validation code is quite simple: // Get XML stream reader from OMElement received XMLStreamReader reader = doc.getXMLStreamReader(); //Create the DOOM OMFactory OMFactory doomFactory = DOOMAbstractFactory.getOMFactory(); //Create the new builder StAXOMBuilder doomBuilder = new StAXOMBuilder(doomFactory, reader); //Get the document element OMElement omElem = doomBuilder.getDocumentElement(); try { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema xsd = factory.newSchema(schemaLocation); Validator validator = xsd.newValidator(); validator.validate(new DOMSource((Element) omElem)); return true; } catch (Exception e) { return false; } Below is a snippet of the stack trace: java.lang.UnsupportedOperationException: TODO atorg.apache.axiom.om.impl.dom.DocumentImpl.getDoctype(DocumentImpl.java:225) atorg.apache.xerces.jaxp.validation.DOMValidatorHelper.setupEntityMap(UnknownSource) atorg.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(UnknownSource) at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(UnknownSource) at javax.xml.validation.Validator.validate(Unknown Source)Note that this works fine in Tomcat 5.5 but chokes in Websphere 6.1 so I suspect there is a class loading issue somewhere. What could be the problem??Thanks,T -- Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us.
Re: [Axis2] schema validation exception
I am using the Axiom and Xerces JAR files included with the Axis2-1.2 distribution: axiom-api-1.2.4.jar axiom-dom-1.2.4.jar axiom-impl-1.2.4.jar xercesImpl-2.8.1.jar I assume those are the right ones?? These are included in the deployed WAR file. I went through the pain of my 1st Websphere installation a few weeks back so I knew to set the parent class loader to last. Is there anything else I should check? I've been flustered thus far. - T Martin Gainty [EMAIL PROTECTED] wrote: For your websphere environment check the version of axiom jar (assume axiom-api-1.1.1.jar) check the version of Xerces (assume version 2.8.0 xercesImpl.jar) in either case I would copy the 2 good jars to your webspere deployment library folder HTH M-- - Original Message - From:JackSprat To: axis-user@ws.apache.org Sent: Monday, September 24, 2007 12:53PM Subject: [Axis2] schema validationexception I am gettingan UnsupportedOperation Exception each time I try to validate an OMElementagainst a schema. I am using Axis2 1.2 with no data binding so myservice class receives an OMElement object. The validation code is quite simple: // Get XML stream readerfrom OMElement received XMLStreamReader reader = doc.getXMLStreamReader(); //Create the DOOM OMFactory OMFactory doomFactory =DOOMAbstractFactory.getOMFactory(); //Create the new builder StAXOMBuilder doomBuilder = new StAXOMBuilder(doomFactory, reader); //Get the documentelement OMElement omElem =doomBuilder.getDocumentElement(); try { SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema xsd =factory.newSchema(schemaLocation); Validator validator =xsd.newValidator(); validator.validate(new DOMSource((Element)omElem)); returntrue; } catch (Exception e) { return false; } Below is a snippet of the stack trace: java.lang.UnsupportedOperationException: TODO at org.apache.axiom.om.impl.dom.DocumentImpl.getDoctype(DocumentImpl.java:225) at org.apache.xerces.jaxp.validation.DOMValidatorHelper.setupEntityMap(Unknown Source) at org.apache.xerces.jaxp.validation.DOMValidatorHelper.validate(Unknown Source) at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source) at javax.xml.validation.Validator.validate(Unknown Source) Note that this works fine in Tomcat 5.5 but chokes in Websphere 6.1 so I suspect there is a class loading issue somewhere. What could be the problem?? Thanks, T - Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search.
Re: [Axis2]. - Disable/Enable client side schema validation with axis and ADB
use -Eosv (off strict validation) option. On 7/23/07, Ravi Somepalli [EMAIL PROTECTED] wrote: My Schema contains data types for which some of the attributes are mandatory, as defined in the schema, but during testing or I just want to disable/enable schema validation. The default client from the samples does schema validation and complains about null values. xs:complexType name=Attachment xs:sequence xs:element name=dealtracid type=xs:int/ xs:element name=tviewid type=xs:int/ xs:element name=attachDesc type=xs:string/ xs:element name=docDate type=xs:date / xs:element name=file type=tns:FileAttachment / /xs:sequence /xs:complexType Please point me to the document that addresses the client setting or the build file options or a snippet of code Thanks Ravi Somepalli -- Amila Suriarachchi, WSO2 Inc.
[Axis2]. - Disable/Enable client side schema validation with axis and ADB
My Schema contains data types for which some of the attributes are mandatory, as defined in the schema, but during testing or I just want to disable/enable schema validation. The default client from the samples does schema validation and complains about null values. xs:complexType name=Attachment xs:sequence xs:element name=dealtracid type=xs:int/ xs:element name=tviewid type=xs:int/ xs:element name=attachDesc type=xs:string/ xs:element name=docDate type=xs:date / xs:element name=file type=tns:FileAttachment / /xs:sequence /xs:complexType Please point me to the document that addresses the client setting or the build file options or a snippet of code Thanks Ravi Somepalli
Schema validation Axis 1.3
Hi I am using Axis 1.3, I wanted to know if there is a way to validate request and response SOAP messages against schemas. I've googled for quite a bit, but couldn't come out with a satisfactory solution. So far I've investigated the Castor option, I think it is a kludge at best. The other option that I am looking at is to use a custom handler to perform the validation. I just wanted to know if users have found this a problem and is there a solution. Thanks in advance, Rishi This message is intended for the addressee or its representative only. Any form of unauthorized use, publication, reproduction, copying or disclosure of the content of this e-mail is not permitted. If you are not the intended recipient of this e-mail message and its contents, please notify the sender immediately and delete this message and all its attachments subsequently.
RE: Schema validation Axis 1.3
Title: RE: Schema validation Axis 1.3 Good luck with this one. I have posted several times about schema validation in axis2 and it looks like you have to do it yourself. I wrote a servlet filter that sits in front of the axis servlet and validates the request against a given xsd. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Fri 11/10/2006 6:47 AM To: axis-user@ws.apache.org Subject: Schema validation Axis 1.3 Hi I am using Axis 1.3, I wanted to know if there is a way to validate request and response SOAP messages against schemas. I've googled for quite a bit, but couldn't come out with a satisfactory solution. So far I've investigated the Castor option, I think it is a kludge at best. The other option that I am looking at is to use a custom handler to perform the validation. I just wanted to know if users have found this a problem and is there a solution. Thanks in advance, Rishi This message is intended for the addressee or its representative only. Any form of unauthorized use, publication, reproduction, copying or disclosure of the content of this e-mail is not permitted. If you are not the intended recipient of this e-mail message and its contents, please notify the sender immediately and delete this message and all its attachments subsequently.
Re: Schema validation Axis 1.3
Hi John, how complex is your filter code? It would be a great entry in the Axis wiki ;-) Regards, Rodrigo Ruiz John Pfeifer wrote: Good luck with this one. I have posted several times about schema validation in axis2 and it looks like you have to do it yourself. I wrote a servlet filter that sits in front of the axis servlet and validates the request against a given xsd. -- --- GRIDSYSTEMS S.A. Rodrigo Ruiz Parc Bit - Son EspanyolR D 07120 Palma de Mallorcarruiz at gridsystems dot com Baleares - España Tel: +34 971 435 085 http://www.gridsystems.com/Fax: +34 971 435 082 --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Schema validation Axis 1.3
Title: RE: Schema validation Axis 1.3 Here is the filter... The trick with this is that you have to wrap the HttpServletRequest so that you can send the request on to filters down stream once you have read the input stream. You can do this using HttpServletRequestWrapper. I will be happy to post this somewhere, but I am not sure where to post it. public class XMLValidationFilter extends GenericFilterBean { /** * The object that is used for logging. */ private static Log log = LogFactory.getLog(XMLValidationFilter.class); /** * schemaMap */ private Map schemaMap = null; /** (non-Javadoc) * @see javax.servlet.Filter#destroy() */ public void destroy() { super.destroy(); } /** * Initialize schemaMap from Spring Context */ private void initSchemaMap() { if (schemaMap == null) { schemaMap = (Map) WebApplicationContextUtils.getWebApplicationContext(getServletContext()).getBean(schemaToURIMap); } } /** (non-Javadoc) * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, * javax.servlet.ServletResponse, javax.servlet.FilterChain) */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final String methodName = doFilter(); if (log.isTraceEnabled()) { log.trace(methodName + : Entry); } HttpServletRequest httpRequest = ((HttpServletRequest) request); if (log.isDebugEnabled()) { log.debug(XMLValidationFilter: doFilter); log.debug(Schema Map Entries + schemaMap); } // set the schemaMap from the spring context, the // context is loaded after the filter is initialized but // before the first request can be handled initSchemaMap(); if (schemaMap.get(httpRequest.getRequestURI()) == null) { if (log.isDebugEnabled()) { log.debug(No schema found for RequestURI + httpRequest.getRequestURI()); } // continue with rest of the filter chain as no further processing is required chain.doFilter(request, response); return; } else { if (log.isDebugEnabled()) { log.debug(Schema found for RequestURI + httpRequest.getRequestURI()); } } XMLValidationRequestWrapper requestWrapper = new XMLValidationRequestWrapper((HttpServletRequest) request); String queryString = httpRequest.getQueryString(); if (log.isDebugEnabled()) { log.debug(queryString = + queryString); } boolean isValid = true; if (!StringUtils.equalsIgnoreCase(queryString, wsdl)) { isValid = validateIncomingXML(httpRequest, requestWrapper); } else { if (log.isInfoEnabled()) { log.info(Skipping XML Schema validation.); } } if (isValid) { if (log.isDebugEnabled()) { log.debug(Continue processing filter chain); } chain.doFilter(requestWrapper, response); } else { log.error(Schema validation failed); generateSOAPFault(response.getOutputStream()); } if (log.isTraceEnabled()) { log.trace(methodName + : Exit); } } /** * validateIncomingXML * @param request * @param httpRequest * @param buffer * @param requestWrapper * @return */ private boolean validateIncomingXML(HttpServletRequest httpRequest, XMLValidationRequestWrapper requestWrapper) { boolean isValid = false; StringBuffer buffer = new StringBuffer(); InputStream xmlIn; String soapRequest; String xmlBody; try { xmlIn = httpRequest.getInputStream(); int x = 0; while ((xmlIn != null) ((x = xmlIn.read()) = 0)) { buffer.append((char) x); } soapRequest = buffer.toString(); if (log.isDebugEnabled()) { log.debug(Original SOAP Request = + soapRequest); } xmlBody = SOAPUtils.getSOAPBody(buffer.toString()); if (log.isDebugEnabled()) { log.debug(XML to be validated = + xmlBody); } XMLSchemaValidator validator = new XMLSchemaValidator(); URL url = "" schemaMap.get(httpRequest.getRequestURI())); if (log.isDebugEnabled()) { log.debug(XSD Url = "" + url); } isValid = validator.validateDocument(xmlBody, url); if (log.isDebugEnabled()) { log.debug(Schema validation isValid = + isValid); } requestWrapper.setBodyText(soapRequest); // Don't parse the request again, set it as a request attribute to be // used by ServiceRequestProxyServlet down stream requestWrapper.setAttribute(ServiceRequestProxyServlet.SOAP_REQUEST_ATTRIBUTE, soapRequest); } catch (Throwable t) { log.error(Error validating xml, t); } return isValid; } private void generateSOAPFault(OutputStream out) { String soapFault = SOAPUtils.generateSOAPFault( Server, Invalid XML, Test Actor, . Details ); try { if (log.isDebugEnabled()) { log.debug(SOAP Fault = + soapFault); } out.write(soapFault.getBytes()); out.flush(); } catch (Throwable t) { log.error(Error Generating SOAP Fault, t); } finally { try { out.close(); } catch (Throwable t) {} } } Here is the schema validator class === public class XMLSchemaValidator { /** * logger */ private static Logger logger = Logger.getLogger(XMLSchemaValidator.class.getName()); /** * JAXP_SCHEMA_LANGUAG
Re: Schema validation Axis 1.3
Our Wiki: http://wiki.apache.org/ws/FrontPage/Axis -- dims On 11/10/06, John Pfeifer [EMAIL PROTECTED] wrote: Here is the filter... The trick with this is that you have to wrap the HttpServletRequest so that you can send the request on to filters down stream once you have read the input stream. You can do this using HttpServletRequestWrapper. I will be happy to post this somewhere, but I am not sure where to post it. public class XMLValidationFilter extends GenericFilterBean { /** * The object that is used for logging. */ private static Log log = LogFactory.getLog(XMLValidationFilter.class); /** * schemaMap */ private Map schemaMap = null; /** (non-Javadoc) * @see javax.servlet.Filter#destroy() */ public void destroy() { super.destroy(); } /** * Initialize schemaMap from Spring Context */ private void initSchemaMap() { if (schemaMap == null) { schemaMap = (Map) WebApplicationContextUtils.getWebApplicationContext(getServletContext()).getBean(schemaToURIMap); } } /** (non-Javadoc) * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, * javax.servlet.ServletResponse, javax.servlet.FilterChain) */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final String methodName = doFilter(); if (log.isTraceEnabled()) { log.trace(methodName + : Entry); } HttpServletRequest httpRequest = ((HttpServletRequest) request); if (log.isDebugEnabled()) { log.debug(XMLValidationFilter: doFilter); log.debug(Schema Map Entries + schemaMap); } // set the schemaMap from the spring context, the // context is loaded after the filter is initialized but // before the first request can be handled initSchemaMap(); if (schemaMap.get(httpRequest.getRequestURI()) == null) { if (log.isDebugEnabled()) { log.debug(No schema found for RequestURI + httpRequest.getRequestURI()); } // continue with rest of the filter chain as no further processing is required chain.doFilter(request, response); return; } else { if (log.isDebugEnabled()) { log.debug(Schema found for RequestURI + httpRequest.getRequestURI()); } } XMLValidationRequestWrapper requestWrapper = new XMLValidationRequestWrapper((HttpServletRequest) request); String queryString = httpRequest.getQueryString(); if (log.isDebugEnabled()) { log.debug(queryString = + queryString); } boolean isValid = true; if (!StringUtils.equalsIgnoreCase(queryString, wsdl)) { isValid = validateIncomingXML(httpRequest, requestWrapper); } else { if (log.isInfoEnabled()) { log.info(Skipping XML Schema validation.); } } if (isValid) { if (log.isDebugEnabled()) { log.debug(Continue processing filter chain); } chain.doFilter(requestWrapper, response); } else { log.error(Schema validation failed); generateSOAPFault(response.getOutputStream()); } if (log.isTraceEnabled()) { log.trace(methodName + : Exit); } } /** * validateIncomingXML * @param request * @param httpRequest * @param buffer * @param requestWrapper * @return */ private boolean validateIncomingXML(HttpServletRequest httpRequest, XMLValidationRequestWrapper requestWrapper) { boolean isValid = false; StringBuffer buffer = new StringBuffer(); InputStream xmlIn; String soapRequest; String xmlBody; try { xmlIn = httpRequest.getInputStream(); int x = 0; while ((xmlIn != null) ((x = xmlIn.read()) = 0)) { buffer.append((char) x); } soapRequest = buffer.toString(); if (log.isDebugEnabled()) { log.debug(Original SOAP Request = + soapRequest); } xmlBody = SOAPUtils.getSOAPBody(buffer.toString()); if (log.isDebugEnabled()) { log.debug(XML to be validated = + xmlBody); } XMLSchemaValidator validator = new XMLSchemaValidator(); URL url = this.getClass().getResource((String) schemaMap.get(httpRequest.getRequestURI())); if (log.isDebugEnabled()) { log.debug(XSD Url = + url); } isValid
Re: Schema Validation using Axis2
Hi John, You have mentioned you will be getting the message using RawXMLINOutMessageReceiver and then passing that to JiBX. Do you know that we have in-built support for JiBX. Just get the wsdl, code generate using that giving -d jibx. Not ony you will get the code to pass your xml to jibx, it will do the validation of the xml against the schema. HTH. Chinthaka John Pfeifer wrote: I have created a test web service (see below). This service uses the RawXMLINOutMessageReceiver and by default does not have a wsdl. I created a WSDL (where I defined the schema of the xml document) and placed it in the META-INF directory. When I test the web service with xml that doesn't adhere to the schema, the request is still processed. Does axis2 ignore the WSDL? If so, how can I validate the schema before it is passed to my web service? I would prefer to have all of the field level validations performed before I pass the XML off to JiBX. I understand that schema validation can be expensive, but I am dealing with small XML documents and am willing to take the hit for the benefit of the field level validations. I would think that this is a common issue that someone else has solved, so any help you can provide would be greatly appreciated. public class TestWebService { private MessageContext inMessageContext = null; public void setOperationContext(OperationContext opContext) throws AxisFault { this.inMessageContext = opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); } public OMElement SendEmail(OMElement element) throws AxisFault, XMLStreamException { System.out.println(test start); JP4 signature.asc Description: OpenPGP digital signature
Re: Schema Validation using Axis2
Hi John, You may start from here[1]. Regards, Ali Sadik Kumlali [1] http://www.mail-archive.com/axis-user@ws.apache.org/msg11312.html - Original Message From: John Pfeifer [EMAIL PROTECTED] To: axis-user@ws.apache.org Sent: Thursday, October 5, 2006 4:07:57 PM Subject: Schema Validation using Axis2 Schema Validation using Axis2 I have created a test web service (see below). This service uses the RawXMLINOutMessageReceiver and by default does not have a wsdl. I created a WSDL (where I defined the schema of the xml document) and placed it in the META-INF directory. When I test the web service with xml that doesn't adhere to the schema, the request is still processed. Does axis2 ignore the WSDL? If so, how can I validate the schema before it is passed to my web service? I would prefer to have all of the field level validations performed before I pass the XML off to JiBX. I understand that schema validation can be expensive, but I am dealing with small XML documents and am willing to take the hit for the benefit of the field level validations. I would think that this is a common issue that someone else has solved, so any help you can provide would be greatly appreciated. public class TestWebService { private MessageContext inMessageContext = null; public void setOperationContext(OperationContext opContext) throws AxisFault { this.inMessageContext = opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); } public OMElement SendEmail(OMElement element) throws AxisFault, XMLStreamException { System.out.println(test start); JP4 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Schema Validation using Axis2
We do not do schema validation in Axis2 .. So you should do it explicitly from your service I am not sure is there a schema validator for OMElement .. you should ask! Thanks Srinath On 10/5/06, John Pfeifer [EMAIL PROTECTED] wrote: I have created a test web service (see below). This service uses the RawXMLINOutMessageReceiver and by default does not have a wsdl. I created a WSDL (where I defined the schema of the xml document) and placed it in the META-INF directory. When I test the web service with xml that doesn't adhere to the schema, the request is still processed. Does axis2 ignore the WSDL? If so, how can I validate the schema before it is passed to my web service? I would prefer to have all of the field level validations performed before I pass the XML off to JiBX. I understand that schema validation can be expensive, but I am dealing with small XML documents and am willing to take the hit for the benefit of the field level validations. I would think that this is a common issue that someone else has solved, so any help you can provide would be greatly appreciated. public class TestWebService { private MessageContext inMessageContext = null; public void setOperationContext(OperationContext opContext) throws AxisFault { this.inMessageContext = opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); } public OMElement SendEmail(OMElement element) throws AxisFault, XMLStreamException { System.out.println(test start); JP4 -- Srinath Perera: http://www.cs.indiana.edu/~hperera/ http://www.bloglines.com/blog/hemapani - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Schema Validation using Axis2
Title: Schema Validation using Axis2 I have created a test web service (see below). This service uses the RawXMLINOutMessageReceiver and by default does not have a wsdl. I created a WSDL (where I defined the schema of the xml document) and placed it in the META-INF directory. When I test the web service with xml that doesn't adhere to the schema, the request is still processed. Does axis2 ignore the WSDL? If so, how can I validate the schema before it is passed to my web service? I would prefer to have all of the field level validations performed before I pass the XML off to JiBX. I understand that schema validation can be expensive, but I am dealing with small XML documents and am willing to take the hit for the benefit of the field level validations. I would think that this is a common issue that someone else has solved, so any help you can provide would be greatly appreciated. public class TestWebService { private MessageContext inMessageContext = null; public void setOperationContext(OperationContext opContext) throws AxisFault { this.inMessageContext = opContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); } public OMElement SendEmail(OMElement element) throws AxisFault, XMLStreamException { System.out.println(test start); JP4
Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice)
Sorry for the silence. I took a couple of days off. True schema validation is an extremely expensive process -- especially if you put uniqueness or referential integrity constraints into the schema. Even checking for nulls can be expensive if it's a large document instance. If you have control over the client environment and know that the client will send only valid messages, then it absolutely doesn't make sense to validate all incoming messages. Also, in some circumstances, you may want to allow systems to add extraneous information or change a type or whatever for extensibility reasons. After all, XML is supposed to be extensible. Validation should be performed only when explicitly requested. As I said in my original response, a databinding framework will always perform some basic validation -- it's expecting to get a particular XML structure that it knows how to map to a particular object graph. If you feed it an unexpected XML structure, it will barf. That's not the same a validation, though. Is it appropriate to check for valid nulls during data binding? Enumerations? Regular expression formatting constraints? Maybe. But where do you draw the line? Anne On 7/12/06, Doug B [EMAIL PROTECTED] wrote: Anne doesn't appear to be around right now, but I'll bug her when it looks like she is. In the meantime, surely some of the other list readers have some opinions on this topic? On 7/9/06, Benjamin Fan [EMAIL PROTECTED] wrote: If there is going to be a discussion then I would very much like to participate in it. I am in the middle of building a production system where I do in fact need to validate against the schema. In fact the WSDL (doc literal) will form the basis of a commercial interface specification for 3rd parties. They will not be Java. Best Regards, Benjamin Fam On 7/10/06, Doug B [EMAIL PROTECTED] wrote: warning: long, best practice questions to follow Interesting to hear you say that, Anne. I've been on a multi-year quest to get automatic, fast validation out of a Web Services engine. Conceptually, it always seemed like the right approach (especially for Document-Literal). If you're having to parse XML anyway, and your XML parser can validate when it does so, why not do it, actually enforcing your restrictive WSDL/Schema at the layer that defines and understands it? At the time, Axis did not do this at all, but my Bugzilla feature request seemed to get agreement that this was a good goal: http://issues.apache.org/jira/browse/AXIS-222 Also at that time, I tried out Systinet Wasp, which did do auto-validation. Much later, I came across the DeveloperWorks article about combining Axis and Castor to get auto-validation: http://www-128.ibm.com/developerworks/webservices/library/ws-castor/ This approach was exactly what I was seeking, so we started using it. It's very simple, but it does seem slow. (I'm also not getting pure POJOs for my schema beans, which I'd really like, but Castor's aren't too bad. Haven't found an XML framework that generates clean POJOs from a schema and don't want to write mapping files if I can help it.) Along the way, we asked everyone we could whether or not auto-validation was a good approach, and we got responses all across the spectrum. Clearly some people expect and want it, but others don't. Some engines can do it, but others can't. If the only reason not to do it is performance, will the newer parsers or something like JiBX make a significant difference? What if you have access to an XML appliance? Would more people do it in that case? I suppose an engine that let you enable and disable it at will would be nice. I'm not exactly sure where I stand at this point, but I'm not quite willing to give up on the dream. That is, the dream of wholly specifying my interface via WSDL/Schema, and having a WS engine completely wrap, translate, and validate requests/responses/exceptions, hiding from my business code the fact that it's even being accessed as a Web Service, but ensuring that anything that comes through the Web Service interface doesn't violate the Web Service's specification. I've started accepting the value of having my business code do business validations as well (namely in cases where I want to use it from other interfaces), but it just seems too natural, logically, for the XML parsing layer to do it. Otherwise, you're throwing away much of the information you've carefully specified (in a handwritten, authoritative, contract WSDL, at least). I'd be happy to take this discussion somewhere else, since it's really not specific to Axis, if you'd like and if you have time to participate in it. Thanks. Doug On 7/7/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: Axis makes no attempt to validate messages. (It's very expensive process that would significantly degrade performance). A databinding system
Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice)
Thanks, Anne. I guess I want to draw the line at what is specifiable in the published interface. So, yes, regular expressions, enumerations, etc. I'd push the decision about using those back on the Schema design phase, not on the implementation engine. I can see you don't agree :-). Where would you draw the line? Just enforcing the tree? With or without enforcement of required/optional elements? Again, is it primarily (current) performance that causes you to not want to automatically enforce the full interface as specified? Said another way, if validation was instantaneous, would you/everyone do it? If not, shouldn't we have chosen something more limited than Schema for specifying the interface? What's the point of such a rich specification if you're not going to enforce it? (Yes, XML is extensible, but I wouldn't expect message sent over a Web Service interface to be.) Also, if I controlled both the client and server sides of a service, I don't think I'd be using Web Services. So I'm assuming especially the server will want to make sure that everything it receives is valid, one way or another. Or should I go back to very loose Schemas where everything is just a string? In case I never said so, my entry into Web Services was from custom socket interfaces where we had to describe in a text document every field and what it was allowed to contain. I thought Schema would take most of that work away from me, but there's not much point in explaining all the constraints in the Schema if I still have to manually duplicate them in code logic. Thanks, as always, for your time and advice. I realize my experience is limited, so I might be missing a lot of scenarios that I should be considering. Doug On 7/12/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: Sorry for the silence. I took a couple of days off. True schema validation is an extremely expensive process -- especially if you put uniqueness or referential integrity constraints into the schema. Even checking for nulls can be expensive if it's a large document instance. If you have control over the client environment and know that the client will send only valid messages, then it absolutely doesn't make sense to validate all incoming messages. Also, in some circumstances, you may want to allow systems to add extraneous information or change a type or whatever for extensibility reasons. After all, XML is supposed to be extensible. Validation should be performed only when explicitly requested. As I said in my original response, a databinding framework will always perform some basic validation -- it's expecting to get a particular XML structure that it knows how to map to a particular object graph. If you feed it an unexpected XML structure, it will barf. That's not the same a validation, though. Is it appropriate to check for valid nulls during data binding? Enumerations? Regular expression formatting constraints? Maybe. But where do you draw the line? Anne On 7/12/06, Doug B [EMAIL PROTECTED] wrote: Anne doesn't appear to be around right now, but I'll bug her when it looks like she is. In the meantime, surely some of the other list readers have some opinions on this topic? On 7/9/06, Benjamin Fan [EMAIL PROTECTED] wrote: If there is going to be a discussion then I would very much like to participate in it. I am in the middle of building a production system where I do in fact need to validate against the schema. In fact the WSDL (doc literal) will form the basis of a commercial interface specification for 3rd parties. They will not be Java. Best Regards, Benjamin Fam On 7/10/06, Doug B [EMAIL PROTECTED] wrote: warning: long, best practice questions to follow Interesting to hear you say that, Anne. I've been on a multi-year quest to get automatic, fast validation out of a Web Services engine. Conceptually, it always seemed like the right approach (especially for Document-Literal). If you're having to parse XML anyway, and your XML parser can validate when it does so, why not do it, actually enforcing your restrictive WSDL/Schema at the layer that defines and understands it? At the time, Axis did not do this at all, but my Bugzilla feature request seemed to get agreement that this was a good goal: http://issues.apache.org/jira/browse/AXIS-222 Also at that time, I tried out Systinet Wasp, which did do auto-validation. Much later, I came across the DeveloperWorks article about combining Axis and Castor to get auto-validation: http://www-128.ibm.com/developerworks/webservices/library/ws-castor/ This approach was exactly what I was seeking, so we started using it. It's very simple, but it does seem slow. (I'm also not getting pure POJOs for my schema beans, which I'd really like, but Castor's aren't too bad. Haven't found an XML framework that generates clean POJOs from a schema and don't want to write mapping files if I can
Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice)
The schema describing the message structure is the published interface. And a schema can include all kinds of validation requirements (e.g., default values, fixed values, uniqueness, referential integrity, etc.) Some of these requirements are extremely expensive to validate. A databinding framework does a reasonably decent job at performing structure validation, but it typically doesn't do data/content validation. You could seriously mar system performance if you required the SOAP server to validate all messages going in or out. -- So yes, my primary objection to automatic validation is entirely about performance. If validation came for free (as does the structural validation when using a databinding framework) then obviously that would be cool. But I do have another objection -- schema poisoning is a security threat. Someone can use validation as a way to lauch a DOS attack or to inject malevant content into a document. If you anticipate that not all clients will send valid messages, then it's a great idea to use a hardware-accelerated intermediary to validate the messages and protect against various security attacks. You can set the intermediary to validate all messages or just messages that come from less than trustworthy sources. And the overhead is minimal. Anne On 7/12/06, Doug B [EMAIL PROTECTED] wrote: Thanks, Anne. I guess I want to draw the line at what is specifiable in the published interface. So, yes, regular expressions, enumerations, etc. I'd push the decision about using those back on the Schema design phase, not on the implementation engine. I can see you don't agree :-). Where would you draw the line? Just enforcing the tree? With or without enforcement of required/optional elements? Again, is it primarily (current) performance that causes you to not want to automatically enforce the full interface as specified? Said another way, if validation was instantaneous, would you/everyone do it? If not, shouldn't we have chosen something more limited than Schema for specifying the interface? What's the point of such a rich specification if you're not going to enforce it? (Yes, XML is extensible, but I wouldn't expect message sent over a Web Service interface to be.) Also, if I controlled both the client and server sides of a service, I don't think I'd be using Web Services. So I'm assuming especially the server will want to make sure that everything it receives is valid, one way or another. Or should I go back to very loose Schemas where everything is just a string? In case I never said so, my entry into Web Services was from custom socket interfaces where we had to describe in a text document every field and what it was allowed to contain. I thought Schema would take most of that work away from me, but there's not much point in explaining all the constraints in the Schema if I still have to manually duplicate them in code logic. Thanks, as always, for your time and advice. I realize my experience is limited, so I might be missing a lot of scenarios that I should be considering. Doug On 7/12/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: Sorry for the silence. I took a couple of days off. True schema validation is an extremely expensive process -- especially if you put uniqueness or referential integrity constraints into the schema. Even checking for nulls can be expensive if it's a large document instance. If you have control over the client environment and know that the client will send only valid messages, then it absolutely doesn't make sense to validate all incoming messages. Also, in some circumstances, you may want to allow systems to add extraneous information or change a type or whatever for extensibility reasons. After all, XML is supposed to be extensible. Validation should be performed only when explicitly requested. As I said in my original response, a databinding framework will always perform some basic validation -- it's expecting to get a particular XML structure that it knows how to map to a particular object graph. If you feed it an unexpected XML structure, it will barf. That's not the same a validation, though. Is it appropriate to check for valid nulls during data binding? Enumerations? Regular expression formatting constraints? Maybe. But where do you draw the line? Anne On 7/12/06, Doug B [EMAIL PROTECTED] wrote: Anne doesn't appear to be around right now, but I'll bug her when it looks like she is. In the meantime, surely some of the other list readers have some opinions on this topic? On 7/9/06, Benjamin Fan [EMAIL PROTECTED] wrote: If there is going to be a discussion then I would very much like to participate in it. I am in the middle of building a production system where I do in fact need to validate against the schema. In fact the WSDL (doc literal) will form the basis of a commercial interface specification for 3rd parties. They will not be Java. Best Regards
Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice)
I'm sure many people would appreciate it if you contributed a handler/module that allowed you to turn validation on/off using a simple configuration setting. Anne On 7/12/06, Derek [EMAIL PROTECTED] wrote: -Original Message- From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 11:50 AM To: axis-user@ws.apache.org Subject: Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice) As I said in my original response, a databinding framework will always perform some basic validation -- it's expecting to get a particular XML structure that it knows how to map to a particular object graph. If you feed it an unexpected XML structure, it will barf. That's not the same a validation, though. Is it appropriate to check for valid nulls during data binding? Enumerations? Regular expression formatting constraints? Maybe. But where do you draw the line? Personally, I'd like to be able to flick a switch and turn full schema validation on, using a real XML validator (like the one built into various Apache XML parsing libraries) as a preprocessing phase prior to parsing the XML with a databinding framework. I'd like to test the system in this configuration for several months against actual data that clients are sending me. I might leave the system this way indefinitely if performance seems acceptable. Otherwise, IF I observe that performance seems to be a problem, I would turn validation off, and run the system in that mode unless I get some indication that garbage data is showing up, in which case I might turn validation on again temporarily to diagnose the problem. I think that turning on and off validation should be an extremely simple operation that should be possible with Axis configured in its default configuration. I shouldn't have to search the Internet for a handler that some third party has written to do it, or to have to write one myself. I think that a simple setting validate-schema='somewhere.xsd' validate='true' in a server config file should be sufficient to turn validation on or off, and possibly interactively through the web administration interface as well. I also think that the user guide should explain exactly how to turn this feature on and off, so I don't have to search the mailing lists to figure out how to do it, and the feature ends up getting used widely by many users. I was pretty surprised, in fact, to find out that Axis and Axis2 apparently can't do this. I would think that validation would be an extremely commonly used feature for debugging purposes. As far as whether or not a databinding framework itself should perform constraint checking, I would like to point out that in most cases, anyone writing a robust web service is going to have to do that checking anyway, since there's no telling what kinds of garbage a generic client to that webservice might send. So if the databinding framework cannot be trusted to validate the XML it parses, the burden is then placed on the person using the databinding framework to write checking code, and manually keep it in sync with the contents of the schema. For instance, every time the getFoo() method is called, the user might need to check it for a possibly null return value. If a regular expression in the schema changes, the checking code must be manually changed to correspond, etc. I don't really see how this situation is preferable to having the databinding framework do the checking itself. I have had to write a lot of this kind of manual checking code, and I consider it a major waste of time. I can see that someone who absolutely must run their code at top possible speed for some reason, and who has some kind of contractual arrangement with ALL of their clients such that the clients can be trusted to send only schematically valid data, might want to turn off such checking. I think that there should be options in WSDL2Java to omit at least the more expensive kinds of checking. Still, every company I have worked in has wanted that checking left on all the time if possible. Part of the reason I use a databinding framework in the first place is that I want to have some of those checks happen without me having to explicitly code them myself. I would like that to happen as much as possible. Derek Anne On 7/12/06, Doug B [EMAIL PROTECTED] wrote: Anne doesn't appear to be around right now, but I'll bug her when it looks like she is. In the meantime, surely some of the other list readers have some opinions on this topic? On 7/9/06, Benjamin Fan [EMAIL PROTECTED] wrote: If there is going to be a discussion then I would very much like to participate in it. I am in the middle of building a production system where I do in fact need to validate against the schema. In fact the WSDL (doc literal) will form the basis of a commercial interface specification for 3rd parties. They will not be Java. Best Regards, Benjamin Fam On 7
Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice)
Thanks for your thoughts, Derek. It sounds like we agree a great deal about our expectations, which at least makes me feel less insane. I had even specifically considered how nice it might be to be able to enable/disable validation easily for different phases of a project. You're description of how that should be was useful. Doug On 7/12/06, Derek [EMAIL PROTECTED] wrote: -Original Message- From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 11:50 AM To: axis-user@ws.apache.org Subject: Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice) As I said in my original response, a databinding framework will always perform some basic validation -- it's expecting to get a particular XML structure that it knows how to map to a particular object graph. If you feed it an unexpected XML structure, it will barf. That's not the same a validation, though. Is it appropriate to check for valid nulls during data binding? Enumerations? Regular expression formatting constraints? Maybe. But where do you draw the line? Personally, I'd like to be able to flick a switch and turn full schema validation on, using a real XML validator (like the one built into various Apache XML parsing libraries) as a preprocessing phase prior to parsing the XML with a databinding framework. I'd like to test the system in this configuration for several months against actual data that clients are sending me. I might leave the system this way indefinitely if performance seems acceptable. Otherwise, IF I observe that performance seems to be a problem, I would turn validation off, and run the system in that mode unless I get some indication that garbage data is showing up, in which case I might turn validation on again temporarily to diagnose the problem. I think that turning on and off validation should be an extremely simple operation that should be possible with Axis configured in its default configuration. I shouldn't have to search the Internet for a handler that some third party has written to do it, or to have to write one myself. I think that a simple setting validate-schema='somewhere.xsd' validate='true' in a server config file should be sufficient to turn validation on or off, and possibly interactively through the web administration interface as well. I also think that the user guide should explain exactly how to turn this feature on and off, so I don't have to search the mailing lists to figure out how to do it, and the feature ends up getting used widely by many users. I was pretty surprised, in fact, to find out that Axis and Axis2 apparently can't do this. I would think that validation would be an extremely commonly used feature for debugging purposes. As far as whether or not a databinding framework itself should perform constraint checking, I would like to point out that in most cases, anyone writing a robust web service is going to have to do that checking anyway, since there's no telling what kinds of garbage a generic client to that webservice might send. So if the databinding framework cannot be trusted to validate the XML it parses, the burden is then placed on the person using the databinding framework to write checking code, and manually keep it in sync with the contents of the schema. For instance, every time the getFoo() method is called, the user might need to check it for a possibly null return value. If a regular expression in the schema changes, the checking code must be manually changed to correspond, etc. I don't really see how this situation is preferable to having the databinding framework do the checking itself. I have had to write a lot of this kind of manual checking code, and I consider it a major waste of time. I can see that someone who absolutely must run their code at top possible speed for some reason, and who has some kind of contractual arrangement with ALL of their clients such that the clients can be trusted to send only schematically valid data, might want to turn off such checking. I think that there should be options in WSDL2Java to omit at least the more expensive kinds of checking. Still, every company I have worked in has wanted that checking left on all the time if possible. Part of the reason I use a databinding framework in the first place is that I want to have some of those checks happen without me having to explicitly code them myself. I would like that to happen as much as possible. Derek Anne On 7/12/06, Doug B [EMAIL PROTECTED] wrote: Anne doesn't appear to be around right now, but I'll bug her when it looks like she is. In the meantime, surely some of the other list readers have some opinions on this topic? On 7/9/06, Benjamin Fan [EMAIL PROTECTED] wrote: If there is going to be a discussion then I would very much like to participate in it. I am in the middle of building a production system where I do in fact need to validate against the schema. In fact the WSDL (doc
Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice)
Folks, There is an effort to build a schema validation mediator in Apache Synapse [1]. So hop on there and ask :) thanks, dims [1] http://www.google.com/search?hl=enlr=safe=offq=synapse-dev+schema+validationbtnG=Search On 7/12/06, Doug B [EMAIL PROTECTED] wrote: Thanks for your thoughts, Derek. It sounds like we agree a great deal about our expectations, which at least makes me feel less insane. I had even specifically considered how nice it might be to be able to enable/disable validation easily for different phases of a project. You're description of how that should be was useful. Doug On 7/12/06, Derek [EMAIL PROTECTED] wrote: -Original Message- From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 11:50 AM To: axis-user@ws.apache.org Subject: Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice) As I said in my original response, a databinding framework will always perform some basic validation -- it's expecting to get a particular XML structure that it knows how to map to a particular object graph. If you feed it an unexpected XML structure, it will barf. That's not the same a validation, though. Is it appropriate to check for valid nulls during data binding? Enumerations? Regular expression formatting constraints? Maybe. But where do you draw the line? Personally, I'd like to be able to flick a switch and turn full schema validation on, using a real XML validator (like the one built into various Apache XML parsing libraries) as a preprocessing phase prior to parsing the XML with a databinding framework. I'd like to test the system in this configuration for several months against actual data that clients are sending me. I might leave the system this way indefinitely if performance seems acceptable. Otherwise, IF I observe that performance seems to be a problem, I would turn validation off, and run the system in that mode unless I get some indication that garbage data is showing up, in which case I might turn validation on again temporarily to diagnose the problem. I think that turning on and off validation should be an extremely simple operation that should be possible with Axis configured in its default configuration. I shouldn't have to search the Internet for a handler that some third party has written to do it, or to have to write one myself. I think that a simple setting validate-schema='somewhere.xsd' validate='true' in a server config file should be sufficient to turn validation on or off, and possibly interactively through the web administration interface as well. I also think that the user guide should explain exactly how to turn this feature on and off, so I don't have to search the mailing lists to figure out how to do it, and the feature ends up getting used widely by many users. I was pretty surprised, in fact, to find out that Axis and Axis2 apparently can't do this. I would think that validation would be an extremely commonly used feature for debugging purposes. As far as whether or not a databinding framework itself should perform constraint checking, I would like to point out that in most cases, anyone writing a robust web service is going to have to do that checking anyway, since there's no telling what kinds of garbage a generic client to that webservice might send. So if the databinding framework cannot be trusted to validate the XML it parses, the burden is then placed on the person using the databinding framework to write checking code, and manually keep it in sync with the contents of the schema. For instance, every time the getFoo() method is called, the user might need to check it for a possibly null return value. If a regular expression in the schema changes, the checking code must be manually changed to correspond, etc. I don't really see how this situation is preferable to having the databinding framework do the checking itself. I have had to write a lot of this kind of manual checking code, and I consider it a major waste of time. I can see that someone who absolutely must run their code at top possible speed for some reason, and who has some kind of contractual arrangement with ALL of their clients such that the clients can be trusted to send only schematically valid data, might want to turn off such checking. I think that there should be options in WSDL2Java to omit at least the more expensive kinds of checking. Still, every company I have worked in has wanted that checking left on all the time if possible. Part of the reason I use a databinding framework in the first place is that I want to have some of those checks happen without me having to explicitly code them myself. I would like that to happen as much as possible. Derek Anne On 7/12/06, Doug B [EMAIL PROTECTED] wrote: Anne doesn't appear to be around right now, but I'll bug her when it looks like she is. In the meantime, surely some
Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice)
warning: long, best practice questions to follow Interesting to hear you say that, Anne. I've been on a multi-year quest to get automatic, fast validation out of a Web Services engine. Conceptually, it always seemed like the right approach (especially for Document-Literal). If you're having to parse XML anyway, and your XML parser can validate when it does so, why not do it, actually enforcing your restrictive WSDL/Schema at the layer that defines and understands it? At the time, Axis did not do this at all, but my Bugzilla feature request seemed to get agreement that this was a good goal: http://issues.apache.org/jira/browse/AXIS-222 Also at that time, I tried out Systinet Wasp, which did do auto-validation. Much later, I came across the DeveloperWorks article about combining Axis and Castor to get auto-validation: http://www-128.ibm.com/developerworks/webservices/library/ws-castor/ This approach was exactly what I was seeking, so we started using it. It's very simple, but it does seem slow. (I'm also not getting pure POJOs for my schema beans, which I'd really like, but Castor's aren't too bad. Haven't found an XML framework that generates clean POJOs from a schema and don't want to write mapping files if I can help it.) Along the way, we asked everyone we could whether or not auto-validation was a good approach, and we got responses all across the spectrum. Clearly some people expect and want it, but others don't. Some engines can do it, but others can't. If the only reason not to do it is performance, will the newer parsers or something like JiBX make a significant difference? What if you have access to an XML appliance? Would more people do it in that case? I suppose an engine that let you enable and disable it at will would be nice. I'm not exactly sure where I stand at this point, but I'm not quite willing to give up on the dream. That is, the dream of wholly specifying my interface via WSDL/Schema, and having a WS engine completely wrap, translate, and validate requests/responses/exceptions, hiding from my business code the fact that it's even being accessed as a Web Service, but ensuring that anything that comes through the Web Service interface doesn't violate the Web Service's specification. I've started accepting the value of having my business code do business validations as well (namely in cases where I want to use it from other interfaces), but it just seems too natural, logically, for the XML parsing layer to do it. Otherwise, you're throwing away much of the information you've carefully specified (in a handwritten, authoritative, contract WSDL, at least). I'd be happy to take this discussion somewhere else, since it's really not specific to Axis, if you'd like and if you have time to participate in it. Thanks. Doug On 7/7/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: Axis makes no attempt to validate messages. (It's very expensive process that would significantly degrade performance). A databinding system will catch many validation issues, but it also does not do true validation. If you pass in elements that it doesn't expect, it will reject the request. But as long as the message matches what the databinding system can deal with, it will pass. If you want to validate the message, then use a handler or intermediary to do so. Anne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Schema Validation (WAS: [axis2] Validating Messages :: WSDL :: choice)
If there is going to be a discussion then I would very much like to participate in it. I am in the middle of building a production system where I do in fact need to validate against the schema. In fact theWSDL (doc literal)will form the basis of a commercial interface specification for 3rd parties. They will not be Java. Best Regards, Benjamin Fam On 7/10/06, Doug B [EMAIL PROTECTED] wrote: warning: long, best practice questions to followInteresting to hear you say that, Anne.I've been on a multi-year quest to get automatic, fast validation out of a Web Services engine.Conceptually, it always seemed like the right approach (especiallyfor Document-Literal).If you're having to parse XML anyway, and your XML parser can validate when it does so, why not do it, actuallyenforcing your restrictive WSDL/Schema at the layer that defines andunderstands it?At the time, Axis did not do this at all, but my Bugzilla feature request seemed to get agreement that this was a good goal:http://issues.apache.org/jira/browse/AXIS-222Also at that time, I tried out Systinet Wasp, which did do auto-validation.Much later, I came across the DeveloperWorks articleabout combining Axis and Castor to get auto-validation:http://www-128.ibm.com/developerworks/webservices/library/ws-castor/ This approach was exactly what I was seeking, so we started using it.It's very simple, but it does seem slow.(I'm also not getting purePOJOs for my schema beans, which I'd really like, but Castor's aren't too bad.Haven't found an XML framework that generates cleanPOJOs from a schema and don't want to write mapping files if I canhelp it.)Along the way, we asked everyone we could whether or not auto-validation was a good approach, and we got responses all acrossthe spectrum.Clearly some people expect and want it, but othersdon't.Some engines can do it, but others can't.If the only reasonnot to do it is performance, will the newer parsers or something like JiBX make a significant difference?What if you have access to an XMLappliance?Would more people do it in that case?I suppose an enginethat let you enable and disable it at will would be nice.I'm not exactly sure where I stand at this point, but I'm not quite willing to give up on the dream.That is, the dream of whollyspecifying my interface via WSDL/Schema, and having a WS enginecompletely wrap, translate, and validaterequests/responses/exceptions, hiding from my business code the fact that it's even being accessed as a Web Service, but ensuring thatanything that comes through the Web Service interface doesn't violatethe Web Service's specification.I've started accepting the value ofhaving my business code do business validations as well (namely in cases where I want to use it from other interfaces), but it just seemstoo natural, logically, for the XML parsing layer to do it.Otherwise, you're throwing away much of the information you'vecarefully specified (in a handwritten, authoritative, contract WSDL, at least).I'd be happy to take this discussion somewhere else, since it's reallynot specific to Axis, if you'd like and if you have time toparticipate in it.Thanks.DougOn 7/7/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: Axis makes no attempt to validate messages. (It's very expensive process that would significantly degrade performance). A databinding system will catch many validation issues, but it also does not do true validation. If you pass in elements that it doesn't expect, it will reject the request. But as long as the message matches what the databinding system can deal with, it will pass. If you want to validate the message, then use a handler or intermediary to do so. Anne - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Schema validation
Hi Anne and Martin, Thank you both for your responses. I already tried to obtain the latest WSDL but it wasn't available. I'll try the handler method. Ken -Original Message-From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]Sent: Monday, May 22, 2006 5:26 AMTo: axis-user@ws.apache.orgSubject: Re: Schema validationKen,I agree with Martin -- your service provider should supply you with a new WSDL. Have you tried just doing a GET on the service URL appended with "?wsdl"?. In the meantime, you can use a handler to validate the message. Java provides native support for validation in the javax.xml.validation package.Anne On 5/22/06, Martin Gainty [EMAIL PROTECTED] wrote: Good Morning KenWho(m)ever is supplying the WSDL to you is responsible for specifying request and response for all methods along with specifyingparameters to those methods.Who(m)ever is changing the schema needs to re-gen and re-publish the WSDL A situation arose where my webservice is now returning a String parameter so I have re-published and regen'ed the WSDL to reflect the response stringwsdl:message name="NameOfMethodResponse" wsdl:part name="NameOfMethodReturn" type="xsd:string" //wsdl:messageDoes this answer your question?Martin --* This email message and any files transmitted with it contain confidentialinformation intended only for the person(s) to whom this email message isaddressed.If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the originalmessage without making a copy.Thank you.- Original Message -From: "Ken Tam" [EMAIL PROTECTED]To: axis-user@ws.apache.orgSent: Sunday, May 21, 2006 9:18 PMSubject: Schema validation Hi all, I am consuming web services made available from my customer. I was given a very elaborate WSDL with schemas and I was able to generate the stubs by using Axis's WSDL2Java. Everything was working fine until the service was changed on the customer's end. This causes the deserialization step to fail as the SOAP response does not match the schema. The customer in this case is a big company and they don't tend to respond in a timely manner. However, the problem persists which I must fix. I am using Axis 1.3 and it doesn't seem to validate the SOAP response with the WSDL's schema. How do I configure Axis to do so? Currently, I had to spend quite a bit of time to track down the mismatches. I figure if the schema is used to validate, it should point out the mismatches right off to spare me the time to track them down. Thanks, Ken - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Schema validation
Good Morning Ken Who(m)ever is supplying the WSDL to you is responsible for specifying request and response for all methods along with specifying parameters to those methods. Who(m)ever is changing the schema needs to re-gen and re-publish the WSDL A situation arose where my webservice is now returning a String parameter so I have re-published and regen'ed the WSDL to reflect the response string wsdl:message name=NameOfMethodResponse wsdl:part name=NameOfMethodReturn type=xsd:string / /wsdl:message Does this answer your question? Martin -- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Ken Tam [EMAIL PROTECTED] To: axis-user@ws.apache.org Sent: Sunday, May 21, 2006 9:18 PM Subject: Schema validation Hi all, I am consuming web services made available from my customer. I was given a very elaborate WSDL with schemas and I was able to generate the stubs by using Axis's WSDL2Java. Everything was working fine until the service was changed on the customer's end. This causes the deserialization step to fail as the SOAP response does not match the schema. The customer in this case is a big company and they don't tend to respond in a timely manner. However, the problem persists which I must fix. I am using Axis 1.3 and it doesn't seem to validate the SOAP response with the WSDL's schema. How do I configure Axis to do so? Currently, I had to spend quite a bit of time to track down the mismatches. I figure if the schema is used to validate, it should point out the mismatches right off to spare me the time to track them down. Thanks, Ken - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Schema validation
Ken,I agree with Martin -- your service provider should supply you with a new WSDL. Have you tried just doing a GET on the service URL appended with ?wsdl?. In the meantime, you can use a handler to validate the message. Java provides native support for validation in the javax.xml.validation package.AnneOn 5/22/06, Martin Gainty [EMAIL PROTECTED] wrote: Good Morning KenWho(m)ever is supplying the WSDL to you is responsible for specifying request and response for all methods along with specifyingparameters to those methods.Who(m)ever is changing the schema needs to re-gen and re-publish the WSDL A situation arose where my webservice is now returning a String parameter so I have re-published and regen'ed the WSDL to reflect the response stringwsdl:message name=NameOfMethodResponse wsdl:part name=NameOfMethodReturn type=xsd:string //wsdl:messageDoes this answer your question?Martin --* This email message and any files transmitted with it contain confidentialinformation intended only for the person(s) to whom this email message isaddressed.If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the originalmessage without making a copy.Thank you.- Original Message -From: Ken Tam [EMAIL PROTECTED]To: axis-user@ws.apache.orgSent: Sunday, May 21, 2006 9:18 PMSubject: Schema validation Hi all, I am consuming web services made available from my customer. I was given a very elaborate WSDL with schemas and I was able to generate the stubs by using Axis's WSDL2Java. Everything was working fine until the service was changed on the customer's end. This causes the deserialization step to fail as the SOAP response does not match the schema. The customer in this case is a big company and they don't tend to respond in a timely manner. However, the problem persists which I must fix. I am using Axis 1.3 and it doesn't seem to validate the SOAP response with the WSDL's schema. How do I configure Axis to do so? Currently, I had to spend quite a bit of time to track down the mismatches. I figure if the schema is used to validate, it should point out the mismatches right off to spare me the time to track them down. Thanks, Ken - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Schema validation
Hi all, I am consuming web services made available from my customer. I was given a very elaborate WSDL with schemas and I was able to generate the stubs by using Axis's WSDL2Java. Everything was working fine until the service was changed on the customer's end. This causes the deserialization step to fail as the SOAP response does not match the schema. The customer in this case is a big company and they don't tend to respond in a timely manner. However, the problem persists which I must fix. I am using Axis 1.3 and it doesn't seem to validate the SOAP response with the WSDL's schema. How do I configure Axis to do so? Currently, I had to spend quite a bit of time to track down the mismatches. I figure if the schema is used to validate, it should point out the mismatches right off to spare me the time to track them down. Thanks, Ken - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Schema validation
Hello Ken, Axis does not have the functionality to validate the SOAP message. You should look for a third-party tool (hopefully others in the group have suggestions) to do that or write one yourself. Good luck, Dies Ken Tam wrote: Hi all, I am consuming web services made available from my customer. I was given a very elaborate WSDL with schemas and I was able to generate the stubs by using Axis's WSDL2Java. Everything was working fine until the service was changed on the customer's end. This causes the deserialization step to fail as the SOAP response does not match the schema. The customer in this case is a big company and they don't tend to respond in a timely manner. However, the problem persists which I must fix. I am using Axis 1.3 and it doesn't seem to validate the SOAP response with the WSDL's schema. How do I configure Axis to do so? Currently, I had to spend quite a bit of time to track down the mismatches. I figure if the schema is used to validate, it should point out the mismatches right off to spare me the time to track them down. Thanks, Ken - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Schema Validation
Hi, I am using Axis 1.3 Can someone point me in the right direction, to accomplish the following? 1) Validate incoming/outgoing xml against a schema...the only place, where I am thinking I can do this, is in a request or response handler...am I correct? has anyone done this before? 2) How can I avoid throwing IllegalArgumentExceptions or Invalid Date/Time Exceptions back to the client, and instead send an xml message with some meaningful error message? do I need to write a custom de-serializer for this? Thanks much for any help! Regards, Vishy
Re: Schema Validation
1. I believe the XML of the request s already deserialized and parsed by the time it reaches any handlers, and is in the form of a DOM. To validate in a handler or in your service implementation you must be able either to validate the DOM or, presumably less efficiently, serialize back to a string or stream and reparse with validation features enabled. If you have a recent-enough version of Xerces (such as the latest), you can validate a DOM in memory against a schema. This can be done in a handler or or in your service implementation. 2. If you control the validation process, you can catch any thrown exceptions and do what you want. It might be possible to turn on validation in the parser that axis is using to deserialize the web service request, but this will just throw exceptions back to the client, unless you could also specify the error handler for the parser (which might be tricky even if allowed, since you still have to meet the constraints of specs Axis implements). Trying to do it this way would also affect all the other axis services in the axis webapp, some of which may not need validation of the request or prefer to do it themselves. Jeff Vishy wrote: Hi, I am using Axis 1.3 Can someone point me in the right direction, to accomplish the following? 1) Validate incoming/outgoing xml against a schema...the only place, where I am thinking I can do this, is in a request or response handler...am I correct? has anyone done this before? 2) How can I avoid throwing IllegalArgumentExceptions or Invalid Date/Time Exceptions back to the client, and instead send an xml message with some meaningful error message? do I need to write a custom de-serializer for this? Thanks much for any help! Regards, Vishy
[Axis2] schema validation
Title: [Axis2] schema validation Hi everybody, I am trying to enable schema validation for my Web service using Axis2 0.94 under linux with the included xerces 2.7.1 parser. I've a couple of questions i hope you can help me with: 1. Is it possible to enable schema validation for a particular service using the default parsing steps taken by the engine? I noticed the XmlSchema-SNAPSHOT.jar in the lib directory, but didn't find any further documentation on this topic. 2. Since i couldn't figure out an answer two question 1, i implemented a validation module, according to the module example and user documentation, that validates incoming messages. But how can i stop message processing if validation fails? The module throws an AxisFault on invalid messages, but the messages are still relayed to the other handlers and finally the service implementation. I searched the web, documentation, mailing list archive and the API reference but couldn't find an answer. Maybe you could point me to an example or further documentation i missed. Best regards and thanks in advance, Andreas
Re: [Axis2] schema validation
Title: [Axis2] schema validation Hi Andreas,Although I'm not sure wheter my suggestion would addresse to your needs, I'll try to write what I did for schema validation.1) Used xmlbeans databinding instead of adb. Therefore, I passed "-d xmlbeans" to WSDL2Java.2) In generated skeleton class I added following methods: // This method is not generated by WSDL2Java protected void log (String desc, String str) { System.out.println(desc + ": " + str); } // This method is not generated by WSDL2Java and can be put in a util // class to make it globally accessible. protected void validate (org.apache.xmlbeans.XmlObject param) throws AxisFault { // Set up the validation error listener. ; ArrayList validationErrors = new ArrayList(); XmlOptions validationOptions = new XmlOptions(); validationOptions.setErrorListener(validationErrors); // During validation, errors are added to the ArrayList for // retrieval and printed. boolean isValid = param.validate(validationOptions); log("Incoming soap message is valid", "" + isValid); // Print the errors if the XML is invalid. if (!isValid) { Iterator iter = validationErrors.iterator(); StringBuffer sb = new StringBuffer(256); sp; while (iter.hasNext()) {sb.append(iter.next());sb.append("\n"); } log ("Validation error", sb.toString()); throw new AxisFault (sb.toString()); } }3) Say I have following method in my generated skeleton class: public com.mycompany.service.test.schemas.account.OpenAccountResultDocument OpenAccount( com.mycompany.service.test.schemas.account.OpenAccountDocument param0) { ; // Auto generated }I added "throws AxisFault" to it and called validate () before doing anything.4) In this way, if client's request soap is not validated against the schema, then validate() method throws and AxisFault and the client gets an soap fault message that exactly shows the validation error. Here is the sample soap fault:?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/"?soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"soapenv:Header/soapenv:Bodysoapenv:FaultfaultcodeClient/faultcodefaultstringerror: cvc-maxLength-valid.1.1: string length (string) is greater than maxLength facet (3) for 2/faultstringfaultactorhttp://myAxisServer/role/default/faultactordetailsoapenv:Exceptionorg.apache.axis2.AxisFault: error: cvc-maxLength-valid.1.1: string length (string) is greater than maxLength facet (3) for 2 at com.mycompany.service.test.account.AccountServicesPortTypeSkeleton.OpenAccount(AccountServicesPortTypeSkeleton.java:57) at com.mycompany.service.test.account.AccountServicesPortTypeMessageReceiver.invokeBusinessLogic(AccountServicesPortTypeMessageReceiver.java:48).../soapenv:Exception/detail/soapenv:Fault/soapenv:Body/soapenv:EnvelopeHope this helps.Ali Sadik Kumlali"Sensen, Andreas (external)" [EMAIL PROTECTED] wrote: Hi everybody , I am trying to enable schema validation for my Web service using Axis2 0.94 under linux with the included xerces 2.7.1 parser. I've a couple of questions i hope you can help me with: 1. Is it possible to enable schema validation for a particular service using the default parsing steps taken by the engine? I noticed the XmlSchema-SNAPSHOT.jar in the lib directory, but didn't find any further documentation on this topic. 2. Since i couldn't figure out an answer two question 1, i implemented a "validation module", according to the module example and user documentation, that validates incoming messages. But h ow can i stop message processing if validation fails? The module throws an AxisFault on invalid messages, but the messages are still relayed to the other handlers and finally the service implementation. I searched the web, documentation, mailing list archive and the API reference but couldn't find an answer. Maybe you could point me to an example or further documentation i missed. Best regards and thanks in advance, Andreas New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
Re: [Axis2] schema validation
Title: [Axis2] schema validation Forgot to add sample for 3th item:public com.mycompany.service.test.schemas.account.OpenAccountResultDocument OpenAccount( com.mycompany.service.test.schemas.account.OpenAccountDocument param0) throws AxisFault { validate (param0);...}Ali Sadik Kumlali [EMAIL PROTECTED] wrote: Hi Andreas,Although I'm not sure wheter my suggestio n would addresse to your needs, I'll try to write what I did for schema validation.1) Used xmlbeans databinding instead of adb. Therefore, I passed "-d xmlbeans" to WSDL2Java.2) In generated skeleton class I added following methods: // This method is not generated by WSDL2Java protected void log (String desc, String str) { System.out.println(desc + ": " + str); } // This method is not generated by WSDL2Java and can be put in a util // class to make it globally accessible. protected void validate (org.apache.xmlbeans.XmlObject param) throws AxisFault { // Set up the validation error listener. ; ArrayList validationErrors = new ArrayList(); XmlOptions validationOptions = new XmlOptions(); validationOptions.setErrorListener(validationErrors); // During validation, errors are added to the ArrayList for // retrieval and printed. boolean isValid = param.validate(validationOptions); log("Incoming soap message is valid", "" + isValid); // Print the errors if the XML is invalid. if (!isValid) { Iterator iter = validationErrors.iterator(); StringBuffer sb = new StringBuffer(256);nb sp; while (iter.hasNext()) { p; sb.append(iter.next());sb.append("\n"); } log ("Validation error", sb.toString()); throw new AxisFault (sb.toString()); } }3) Say I have following method in my generated skeleton class: public com.mycompany.service.test.schemas.account.OpenAccountResultDocument OpenAccount( com.mycompany.service.test.schemas.account.OpenAccountDocument param0) { ; // Auto generated }I added "throws AxisFault" to it and called validate () before doing anything.4) In this way, if client's request soap is not validated against the schema, then validate() method throws and AxisFault and the client gets an soap fault message that exactly shows the validation error. Here is the sample soap fault:?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/"?soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"soapenv:Header/soapenv:Bodysoapenv:FaultfaultcodeClient/faultcodefaultstringerror: cvc-maxLength-valid.1.1: string length (string) is greater than maxLength facet (3) for 2/faultstringfaultactorhttp://myAxisServer/role/default/faultactordetailsoapenv:Exceptionorg.apache.axis2.AxisFault: error: cvc-maxLength-valid.1.1: string length (string) is greater than maxLength facet (3) for 2 at com.mycompany.service.test.account.AccountServicesPortTypeSkeleton.OpenAccount(AccountServicesPortTypeSkeleton.java:57) at com.mycompany.service.test.account.AccountServicesPortTypeMessageReceiver.invokeBusinessLogic(AccountServicesPortTypeMessageReceiver.java:48).../soapenv:Exception/detail/soapenv:Fault/soapenv:Body/soapenv:EnvelopeHope this helps.Ali Sadik Kumlali"Sensen, Andreas (external)" [EMAIL PROTECTED] wrote: Hi everybody ,I am trying to enable schema validation for my Web service using Axis2 0.94 under linux with the included xerces 2.7.1 parser. I've a couple of questions i hope you can help me with: 1. Is it possible to enable schema validation for a particular service using the default parsing steps taken by the engine? I noticed the XmlSchema-SNAPSHOT.jar in the lib directory, but didn't find any further documentation on this topic. 2. Since i couldn't figure out an answer two question 1, i implemented a "validation module", according to the module example and user documentation, that validates incoming messages. But h ow can i stop message processing if validation fails? The module throws an AxisFault on invalid messages, but the messages are still relayed to the other handlers and finally the service implementation. I searched the web, documentation, mailing list archive and the API reference but couldn't find an answer. Maybe you could point me to an example or further documentation i missed. Best regards and thanks in advance, Andreas New Yahoo! Messenger with Voice. Call regular phones from your PC and save big. New Yahoo! Messenger with Voice. Call regular phones from your PC for low, low rates.
AW: [Axis2] schema validation
Title: Nachricht Hi Ali, thanks for the quick and detailed response,it helped me a lot! I have just one followup question which you might have an answer to: I'd really like to keep the validation in a module. Itthrows an AxisFault if an incoming message is invalid. But instead of sending a SOAPFault to the sender the message is further processed by the engine. Do you have any idea why? Andreas -Ursprüngliche Nachricht-Von: Ali Sadik Kumlali [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 23. März 2006 10:54An: axis-user@ws.apache.orgBetreff: Re: [Axis2] schema validationForgot to add sample for 3th item:public com.mycompany.service.test.schemas.account.OpenAccountResultDocument OpenAccount( com.mycompany.service.test.schemas.account.OpenAccountDocument param0) throws AxisFault { validate (param0);...}
Re: AW: [Axis2] schema validation
Title: Nachricht I wish I would have an answer, but I'm a newbie :) Other members might answer.Good luck,Ali Sadik Kumlali"Sensen, Andreas (external)" [EMAIL PROTECTED] wrote: Hi Ali, thanks for the quick and detailed response,it helped me a lot! I have just one follo wup question which you might have an answer to: I'd really like to keep the validation in a module. Itthrows an AxisFault if an incoming message is invalid. But instead of sending a SOAPFault to the sender the message is further processed by the engine. Do you have any idea why? Andreas -Urspr�ngliche Nachricht-Von: Ali Sadik Kumlali[mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 23. M�rz 200610:54An: axis-user@ws.apache.orgBetreff: Re: [Axis2]schema validationForgot to add sample for 3thitem:publiccom.mycompany.service.test.schemas.account.OpenAccountResultDocumentOpenAccount(com.mycompany.service.test.schemas.account.OpenAccountDocument param0) throwsAxisFault { validate(param0);...}__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: AW: [Axis2] schema validation
Hi Andreas, What do you mean by But instead of sending a SOAPFault to the sender the message is further processed by the engine. ? Do you want engine not to invoke fault flow and send the message ? I don't think its a good idea. There can be some processing that has to be done by the handlers in the fault out flow. For example, the admin might decide to log every fault message. And addressing out handler again helps you to put the stuff in the msgCtxt to the SOAP message. So due to that, its not good only to invoke TransportSender, once a fault is thrown. -- Chinthaka Sensen, Andreas (external) wrote: Hi Ali, thanks for the quick and detailed response, it helped me a lot! I have just one followup question which you might have an answer to: I'd really like to keep the validation in a module. It throws an AxisFault if an incoming message is invalid. But instead of sending a SOAPFault to the sender the message is further processed by the engine. Do you have any idea why? Andreas -Ursprüngliche Nachricht- *Von:* Ali Sadik Kumlali [mailto:[EMAIL PROTECTED] *Gesendet:* Donnerstag, 23. März 2006 10:54 *An:* axis-user@ws.apache.org *Betreff:* Re: [Axis2] schema validation Forgot to add sample for 3th item: public com.mycompany.service.test.schemas.account.OpenAccountResultDocument OpenAccount( com.mycompany.service.test.schemas.account.OpenAccountDocument param0) throws AxisFault { validate (param0); ... }
AW: AW: [Axis2] schema validation
Hi Chinthaka, sorry if i'm not describing my problem clearly enough. The point is that, instead of going through the fault flow, the message is further processed by the in flow, i.e. the invalid message reaches my service implementation. An excerpt of my handler implementation looks as follows: public class MessageValidatorInHandler extends AbstractHandler implements Handler { public void invoke(MessageContext msgContext) throws AxisFault { // Here the message body is validated against a schema // and then: if(validationError) { throw new AxisFault(Message is invalid!); } } } This handler processes incoming messages. I would like to send back a SOAPFault, if an error occured, but thats not happening. I'm sorry if i made an obvious mistake. This is just for a sample Web service to get to know the engine better. And sadly i'm no java expert. Andreas -Ursprüngliche Nachricht- Von: Eran Chinthaka [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 23. März 2006 12:51 An: axis-user@ws.apache.org Betreff: Re: AW: [Axis2] schema validation Hi Andreas, What do you mean by But instead of sending a SOAPFault to the sender the message is further processed by the engine. ? Do you want engine not to invoke fault flow and send the message ? I don't think its a good idea. There can be some processing that has to be done by the handlers in the fault out flow. For example, the admin might decide to log every fault message. And addressing out handler again helps you to put the stuff in the msgCtxt to the SOAP message. So due to that, its not good only to invoke TransportSender, once a fault is thrown. -- Chinthaka Sensen, Andreas (external) wrote: Hi Ali, thanks for the quick and detailed response, it helped me a lot! I have just one followup question which you might have an answer to: I'd really like to keep the validation in a module. It throws an AxisFault if an incoming message is invalid. But instead of sending a SOAPFault to the sender the message is further processed by the engine. Do you have any idea why? Andreas -Ursprüngliche Nachricht- *Von:* Ali Sadik Kumlali [mailto:[EMAIL PROTECTED] *Gesendet:* Donnerstag, 23. März 2006 10:54 *An:* axis-user@ws.apache.org *Betreff:* Re: [Axis2] schema validation Forgot to add sample for 3th item: public com.mycompany.service.test.schemas.account.OpenAccountResultDocument OpenAccount( com.mycompany.service.test.schemas.account.OpenAccountDocument param0) throws AxisFault { validate (param0); ... }
Re: rpc/literal and Schema Validation
Hi Anne i think i was doing mistake in my dev. i got it that we can't validate input. I got it from your reply that we should avoid to use rpc/literal. but we are implementing WS-I profile and according to specification we must have to implement rpc/literal. it would be great if you explain which is the best solution for validating xml input. Thanks for your help.. Rakesh On 2/24/06, Rakesh Sanghvi [EMAIL PROTECTED] wrote: Hi Anne Thanks for your valuable reply. Let me explain in detail... Example:- xsd:element name=radius xsd:simpleType xsd:restriction base=xsd:float xsd:minInclusive value=0.05/ xsd:maxInclusive value=1.0/ /xsd:restriction /xsd:simpleType /xsd:element if radius element value is not between 0.05 to 1.0 i believe Axis should throw an error.let me know if my understanding is wrong.. Thanks Rakesh On 2/24/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: Rakesh,Axis never automatically performs schema validation, although it will throw an error if it encounters an element or type that it doesn't expect when parsing the message. This is true whether you are using doc/lit, rpc/lit, or rpc/encoded. If you would like to add a validation process, then your best bet is to use doc/lit because you have the schema of the full payload. When using rpc/lit, you don't have the schema for the full payload, so instead you must validate each accessor element (the parameters) based on its type definition. It's very difficult to validate rpc/encoded because even the types might be changed during the encoding and yet it's still valid based on the SOAP Encoding datamodel. In any case, quite a few SOAP implementations don't support rpc/literal, so I suggest you not use it. Use wrapped doc/literal instead. Wrapped doc/literal provides the same programming experience as rpc/literal, it supports easier validation, and it gives you much better interoperability. I'm not sure why you're thinking that JAXB will help you here. (Are you perhaps under the common misconception that Axis won't map doc/literal to Java objects for you? It does.) I think it's much easier to use the built-in Axis serialization system than to use JAXB. (Axis 2 supports a much more pluggable serialization framework, but not so with Axis 1.) If you want to use an external serialization framework, then I suggest xmlbeans rather than JAXB. Google Axis and xmlbeans, and I'm sure you'll find plenty of resources to help you. Anne On 2/24/06, Rakesh Sanghvi [EMAIL PROTECTED] wrote: Hi Just want to confirm if i implemented my WSDL SOAP binding as rpc/litteral then I believe Schema validation will not happened automatically. if it is true then will it JAXB will be fine for validating SOAP request against schema. Let me know if any good suggestion. Thanks Rakesh
Re: rpc/literal and Schema Validation
WS-I allows document/literal and rpc/literal. But as I said, many systems don't support rpc/literal, so I strongly recommend that you change your specification to use doc/literal instead. If you use the wrapped convention with doc/literal, the messages on the wire and the programming model are virtually identical to rpc/literal, and you can do validation. In other words, use wrapped doc/literal.AnneOn 2/25/06, Rakesh Sanghvi [EMAIL PROTECTED] wrote:Hi Anne i think i was doing mistake in my dev. i got it that we can't validate input. I got it from your reply that we should avoid to use rpc/literal. but we are implementing WS-I profile and according to specification we must have to implement rpc/literal. it would be great if you explain which is the best solution for validating xml input. Thanks for your help.. Rakesh On 2/24/06, Rakesh Sanghvi [EMAIL PROTECTED] wrote: Hi Anne Thanks for your valuable reply. Let me explain in detail... Example:- xsd:element name=radius xsd:simpleType xsd:restriction base=xsd:float xsd:minInclusive value=0.05/ xsd:maxInclusive value=1.0/ /xsd:restriction /xsd:simpleType /xsd:element if radius element value is not between 0.05 to 1.0 i believe Axis should throw an error.let me know if my understanding is wrong.. Thanks Rakesh On 2/24/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: Rakesh,Axis never automatically performs schema validation, although it will throw an error if it encounters an element or type that it doesn't expect when parsing the message. This is true whether you are using doc/lit, rpc/lit, or rpc/encoded. If you would like to add a validation process, then your best bet is to use doc/lit because you have the schema of the full payload. When using rpc/lit, you don't have the schema for the full payload, so instead you must validate each accessor element (the parameters) based on its type definition. It's very difficult to validate rpc/encoded because even the types might be changed during the encoding and yet it's still valid based on the SOAP Encoding datamodel. In any case, quite a few SOAP implementations don't support rpc/literal, so I suggest you not use it. Use wrapped doc/literal instead. Wrapped doc/literal provides the same programming experience as rpc/literal, it supports easier validation, and it gives you much better interoperability. I'm not sure why you're thinking that JAXB will help you here. (Are you perhaps under the common misconception that Axis won't map doc/literal to Java objects for you? It does.) I think it's much easier to use the built-in Axis serialization system than to use JAXB. (Axis 2 supports a much more pluggable serialization framework, but not so with Axis 1.) If you want to use an external serialization framework, then I suggest xmlbeans rather than JAXB. Google Axis and xmlbeans, and I'm sure you'll find plenty of resources to help you. Anne On 2/24/06, Rakesh Sanghvi [EMAIL PROTECTED] wrote: Hi Just want to confirm if i implemented my WSDL SOAP binding as rpc/litteral then I believe Schema validation will not happened automatically. if it is true then will it JAXB will be fine for validating SOAP request against schema. Let me know if any good suggestion. Thanks Rakesh
rpc/literal and Schema Validation
Hi Just want to confirm if i implemented my WSDL SOAP binding as rpc/litteral then I believe Schema validation will not happened automatically. if it is true then will it JAXB will be fine for validating SOAP request against schema. Let me know if any good suggestion. Thanks Rakesh
Re: rpc/literal and Schema Validation
Rakesh,Axis never automatically performs schema validation, although it will throw an error if it encounters an element or type that it doesn't expect when parsing the message. This is true whether you are using doc/lit, rpc/lit, or rpc/encoded. If you would like to add a validation process, then your best bet is to use doc/lit because you have the schema of the full payload. When using rpc/lit, you don't have the schema for the full payload, so instead you must validate each accessor element (the parameters) based on its type definition. It's very difficult to validate rpc/encoded because even the types might be changed during the encoding and yet it's still valid based on the SOAP Encoding datamodel. In any case, quite a few SOAP implementations don't support rpc/literal, so I suggest you not use it. Use wrapped doc/literal instead. Wrapped doc/literal provides the same programming experience as rpc/literal, it supports easier validation, and it gives you much better interoperability. I'm not sure why you're thinking that JAXB will help you here. (Are you perhaps under the common misconception that Axis won't map doc/literal to Java objects for you? It does.) I think it's much easier to use the built-in Axis serialization system than to use JAXB. (Axis 2 supports a much more pluggable serialization framework, but not so with Axis 1.) If you want to use an external serialization framework, then I suggest xmlbeans rather than JAXB. Google Axis and xmlbeans, and I'm sure you'll find plenty of resources to help you. AnneOn 2/24/06, Rakesh Sanghvi [EMAIL PROTECTED] wrote: Hi Just want to confirm if i implemented my WSDL SOAP binding as rpc/litteral then I believe Schema validation will not happened automatically. if it is true then will it JAXB will be fine for validating SOAP request against schema. Let me know if any good suggestion. Thanks Rakesh
Re: rpc/literal and Schema Validation
Hi Anne Thanks for your valuable reply. Let me explain in detail... Example:- xsd:element name=radius xsd:simpleType xsd:restriction base=xsd:float xsd:minInclusive value=0.05/ xsd:maxInclusive value=1.0/ /xsd:restriction /xsd:simpleType /xsd:element if radius element value is not between 0.05 to 1.0 i believe Axis should throw an error.let me know if my understanding is wrong.. Thanks Rakesh On 2/24/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: Rakesh,Axis never automatically performs schema validation, although it will throw an error if it encounters an element or type that it doesn't expect when parsing the message. This is true whether you are using doc/lit, rpc/lit, or rpc/encoded. If you would like to add a validation process, then your best bet is to use doc/lit because you have the schema of the full payload. When using rpc/lit, you don't have the schema for the full payload, so instead you must validate each accessor element (the parameters) based on its type definition. It's very difficult to validate rpc/encoded because even the types might be changed during the encoding and yet it's still valid based on the SOAP Encoding datamodel. In any case, quite a few SOAP implementations don't support rpc/literal, so I suggest you not use it. Use wrapped doc/literal instead. Wrapped doc/literal provides the same programming experience as rpc/literal, it supports easier validation, and it gives you much better interoperability. I'm not sure why you're thinking that JAXB will help you here. (Are you perhaps under the common misconception that Axis won't map doc/literal to Java objects for you? It does.) I think it's much easier to use the built-in Axis serialization system than to use JAXB. (Axis 2 supports a much more pluggable serialization framework, but not so with Axis 1.) If you want to use an external serialization framework, then I suggest xmlbeans rather than JAXB. Google Axis and xmlbeans, and I'm sure you'll find plenty of resources to help you. Anne On 2/24/06, Rakesh Sanghvi [EMAIL PROTECTED] wrote: Hi Just want to confirm if i implemented my WSDL SOAP binding as rpc/litteral then I believe Schema validation will not happened automatically. if it is true then will it JAXB will be fine for validating SOAP request against schema. Let me know if any good suggestion. Thanks Rakesh