<!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;">&#160;</p><p>I create a simple WSDL which imports a schema and build a WS from it, deploy to my server.&#160; It all works, but I want my WS to validate input against the schema.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I add the "@SchemaValidation" annotation to my endpoint.&#160; </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</p><p>In this SOAP-UI project I fill my request object with invalid data.&#160; The SOAP-UI validator tells me the data is invalid.&#160; I then send it to my app and it is accepted.&#160; In the JBoss Logs, I see</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>11:53:58,064 INFO&#160; [SOAPBodyElementDoc] Validating: XML_VALID</p><p><span>11:53:58,064 WARN&#160; [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&#160; [SOAPBodyElementDoc] Validating: XML_VALID</p><p><span>11:53:58,064 WARN&#160; [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;">&#160;</p><p>What's going on here?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>If instead, I try to specify a schema location in the @SchemaValidation annotation, nothing I provide works.&#160; I get only errors. It can't find my schema.&#160; I have tried many forms of specifying the location, none of them work.&#160; 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;">&#160;</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;">&#160;</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;">&#160;</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.&#160; Before I go down this road, can someone tell me if it's still operative?&#160; It seems rather convoluted.&#160; I must apparently modify my wsdl and schema.&#160; Why is all this required?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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>.&#160; But the links it references are dead.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</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.&#160; </p><pre class="jive-pre"><code class="jive-code jive-xml">&#160; <span class="jive-xml-tag">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;</span> 

- <span class="jive-xml-tag"><span>&lt;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>"&gt;</span></span>
&#160; <span class="jive-xml-tag"><span>&lt;import location="</span><a class="jive-link-external-small" href="http://localhost:8080/myws?wsdl&amp;resource=MyServicePort_PortType7607580749899406152.wsdl" target="_blank">http://localhost:8080/myws?wsdl&amp;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>"&#160; /&gt;</span></span> 

- <span class="jive-xml-tag">&lt;service name="MyService"&gt;</span>
- <span class="jive-xml-tag">&lt;port binding="ns1:MyServicePortBinding" name="MyServiceSOAP"&gt;</span>
&#160; <span class="jive-xml-tag"><span>&lt;soap:address location="</span><a class="jive-link-external-small" href="http://localhost:8080/myws" target="_blank">http://localhost:8080/myws</a><span>" /&gt;</span></span> 
&#160; <span class="jive-xml-tag">&lt;/port&gt;</span>


&#160; <span class="jive-xml-tag">&lt;/service&gt;</span>


&#160; <span class="jive-xml-tag">&lt;/definitions&gt;</span>





</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</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;">&#160;</p><p>Perhaps I could solve this if I could forceJBoss to just deploy my WSDLs and XSDs as written without transforming them first.&#160; 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>