<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
@SchemaValidation craziness
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/stevecoh4">Steve Cohen</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/630664#630664">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>I am trying to use SchemaValidation with JBoss 5.1 and getting nowhere.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I create a simple WSDL which imports a schema and build a WS from it, deploy to my server.  It all works, but I want my WS to validate input against the schema.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I add the "@SchemaValidation" annotation to my endpoint.  </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span>Using SOAP-UI I create a project, built upon my wsdl at </span><a class="jive-link-external-small" href="http://localhost:8080/myapp?wsdl" target="_blank">http://localhost:8080/myapp?wsdl</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>In this SOAP-UI project I fill my request object with invalid data.  The SOAP-UI validator tells me the data is invalid.  I then send it to my app and it is accepted.  In the JBoss Logs, I see</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>11:53:58,064 INFO  [SOAPBodyElementDoc] Validating: XML_VALID</p><p><span>11:53:58,064 WARN  [SchemaExtractor] Cannot find element: {</span><a class="jive-link-external-small" href="http://schemas.xmlsoap.org/wsdl/" target="_blank">http://schemas.xmlsoap.org/wsdl/</a><span>}types</span></p><p>11:53:58,064 INFO  [SOAPBodyElementDoc] Validating: XML_VALID</p><p><span>11:53:58,064 WARN  [SchemaExtractor] Cannot find element: {</span><a class="jive-link-external-small" href="http://schemas.xmlsoap.org/wsdl/" target="_blank">http://schemas.xmlsoap.org/wsdl/</a><span>}types</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>What's going on here?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p><span>If instead, I try to specify a schema location in the @SchemaValidation annotation, nothing I provide works.  I get only errors. It can't find my schema.  I have tried many forms of specifying the location, none of them work.  Given that my wsdl is here: </span><a class="jive-link-external-small" href="http://localhost:8080/myapp?wsdl" target="_blank">http://localhost:8080/myapp?wsdl</a><span> and that my schema import is called MessageSchema.xsd located in the same directory as the WSDL , can someone tell me the proper way to reference this in the @SchemaValidation?</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I've found several articles on this subject, none of which get me to a solution.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>First, there is this<a class="" href="http://community.jboss.org/docs/DOC-14076"> Validation Demo</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>But this is for an earlier version, has several dead links, and mentions a sample Eclipse project I can get from the author by email.  Before I go down this road, can someone tell me if it's still operative?  It seems rather convoluted.  I must apparently modify my wsdl and schema.  Why is all this required?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>There is or was apparently information on this referenced in several links from this <a class="jive-link-external-small" href="http://">JIRA issue</a>.  But the links it references are dead.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I simply want to deploy my app with a WSDL, which evidently is correct since SOAP UI can read and parse the WSDL and tell me correctly whether or not input is valid, and have the same validation perfomed on the server.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>What I suspect is going on is that JBoss is taking my WSDL and regenerating it an equivalent form that SoapUI and other clients can parse, but making useless any references to my original schema.  </p><pre class="jive-pre"><code class="jive-code jive-xml">  <span class="jive-xml-tag"><?xml version="1.0" encoding="UTF-8" ?></span>
- <span class="jive-xml-tag"><span><definitions name="MyService" targetNamespace="</span><a class="jive-link-external-small" href="http://anyone.com/MyService" target="_blank">http://anyone.com/MyService</a><span>"
xmlns="</span><a class="jive-link-external-small" href="http://schemas.xmlsoap.org/wsdl/" target="_blank">http://schemas.xmlsoap.org/wsdl/</a><span>"
xmlns:ns1="</span><a class="jive-link-external-small" href="http://anyone.com/MyService" target="_blank">http://anyone.com/MyService</a><span>"
xmlns:soap="</span><a class="jive-link-external-small" href="http://schemas.xmlsoap.org/wsdl/soap/" target="_blank">http://schemas.xmlsoap.org/wsdl/soap/</a><span>"
xmlns:tns="</span><a class="jive-link-external-small" href="http://anyone.com/MyService" target="_blank">http://anyone.com/MyService</a><span>"
xmlns:xsd="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema" target="_blank">http://www.w3.org/2001/XMLSchema</a><span>"></span></span>
  <span class="jive-xml-tag"><span><import location="</span><a class="jive-link-external-small" href="http://localhost:8080/myws?wsdl&resource=MyServicePort_PortType7607580749899406152.wsdl" target="_blank">http://localhost:8080/myws?wsdl&resource=MyServicePort_PortType7607580749899406152.wsdl</a><span>"
namespace="</span><a class="jive-link-external-small" href="http://anyone.com/MyService" target="_blank">http://anyone.com/MyService</a><span>"  /></span></span>
- <span class="jive-xml-tag"><service name="MyService"></span>
- <span class="jive-xml-tag"><port binding="ns1:MyServicePortBinding" name="MyServiceSOAP"></span>
  <span class="jive-xml-tag"><span><soap:address location="</span><a class="jive-link-external-small" href="http://localhost:8080/myws" target="_blank">http://localhost:8080/myws</a><span>" /></span></span>
  <span class="jive-xml-tag"></port></span>
  <span class="jive-xml-tag"></service></span>
  <span class="jive-xml-tag"></definitions></span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>The JBoss deployer is restructuring my WSDL for some reason and putting most of it into an inport with a strange name.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Perhaps I could solve this if I could forceJBoss to just deploy my WSDLs and XSDs as written without transforming them first.  Is this possible?</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/630664#630664">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>