1 Reply Latest reply on Oct 7, 2011 7:06 PM by Steve Cohen

    @SchemaValidation craziness

    Steve Cohen Newbie

      I am trying to use SchemaValidation with JBoss 5.1 and getting nowhere.

       

      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.

       

      I add the "@SchemaValidation" annotation to my endpoint. 

       

      Using SOAP-UI I create a project, built upon my wsdl at http://localhost:8080/myapp?wsdl

       

      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

       

      11:53:58,064 INFO  [SOAPBodyElementDoc] Validating: XML_VALID

      11:53:58,064 WARN  [SchemaExtractor] Cannot find element: {http://schemas.xmlsoap.org/wsdl/}types

      11:53:58,064 INFO  [SOAPBodyElementDoc] Validating: XML_VALID

      11:53:58,064 WARN  [SchemaExtractor] Cannot find element: {http://schemas.xmlsoap.org/wsdl/}types

       

      What's going on here?

       

      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: http://localhost:8080/myapp?wsdl 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?

       

      I've found several articles on this subject, none of which get me to a solution.

       

      First, there is this Validation Demo

       

      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?

       

      There is or was apparently information on this referenced in several links from this JIRA issue.  But the links it references are dead.

       

      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.

       

      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. 

        <?xml version="1.0" encoding="UTF-8" ?> 
      
      - <definitions name="MyService" targetNamespace="http://anyone.com/MyService" 
      xmlns="http://schemas.xmlsoap.org/wsdl/" 
      xmlns:ns1="http://anyone.com/MyService" 
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
      xmlns:tns="http://anyone.com/MyService" 
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <import location="http://localhost:8080/myws?wsdl&resource=MyServicePort_PortType7607580749899406152.wsdl" 
      namespace="http://anyone.com/MyService"  /> 
      
      - <service name="MyService">
      - <port binding="ns1:MyServicePortBinding" name="MyServiceSOAP">
        <soap:address location="http://localhost:8080/myws" /> 
        </port>
      
      
        </service>
      
      
        </definitions>
      
      
      
      
      
      

       

      The JBoss deployer is restructuring my WSDL for some reason and putting most of it into an inport with a strange name.

       

      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?