4 Replies Latest reply on Dec 7, 2011 5:08 AM by nielsm

    How to enable schema validation with JBoss 7

    nielsm

      The web service I'm developing is working fine, except that I cannot figure out how to activate schema validation. I have several colleagues that have given up on this in other projects. But surely there must be a way. In the apache-cxf-2.4.4 binary I can see that wsdl_first_soap12 does schema validation fine - and it doesn't resort to writing handlers or interceptors or XML-configuration (as far as I can see) - but how that works is a mystery to me.

       

      When I start JBoss I see:

       

      [org.jboss.wsf.stack.cxf.metadata.MetadataBuilder] (MSC service thread 1-1) Add Service

      id=LuliPortTypeImpl

      address=http://localhost:8080/gflk-hunt-ws/LuliService/LuliPortType

      implementor=com.visma.gflk.hunting.recreational.ws.LuliPortTypeImpl

      invoker=org.jboss.wsf.stack.cxf.JBossWSInvoker

      serviceName={urn:luli:wsdl:v1}LuliService

      portName={urn:luli:wsdl:v1}LuliPort

      wsdlLocation=null

       

      which looks fine (except for wsdlLocation=null). But then it continues with:

       

      [org.jboss.ws.common.management.DefaultEndpointRegistry] (MSC service thread 1-1) register: jboss.ws:context=gflk-hunt-ws,endpoint=LuliPortTypeImpl

      [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-1) Creating Service urn:luli:wsdl:v1}LuliService from WSDL: /META-INF/wsdl/luli.wsdl

      WARN  [org.jboss.wsf.stack.cxf.resolver.JBossWSResourceResolver] (MSC service thread 1-1) Cannot resolve resource: cxf

       

      The second line looks like it finds the WSDL file all right; but I'm worried about the warning.

       

      The annotations I use are the following:

      @Stateless

      @MTOM

      @WebService(

              wsdlLocation = "/META-INF/wsdl/luli.wsdl",

              portName="LuliPort",

              name = "LuliPortType",

              serviceName="LuliService", targetNamespace="urn:luli:wsdl:v1",

              endpointInterface = "luli.wsdl.v1.LuliPortType")

      @javax.xml.ws.BindingType(value =

      "http://www.w3.org/2003/05/soap/bindings/HTTP/")

      @org.apache.cxf.annotations.SchemaValidation(enabled = true)

       

      Does anybody have a suggestion?

        • 1. Re: How to enable schema validation with JBoss 7
          jim.ma

          This is an issue in jbossws. I've created a jira https://issues.jboss.org/browse/JBWS-3394 and fixed locally. It will be merged in AS7 upstream shortly and I will let you know when it's done. Thanks for reporting this.

          • 2. Re: How to enable schema validation with JBoss 7
            asoldano

            Hi Niels,

            we've just discussed this a bit and basically this can't be considered a bug. Have a look at the "Using Apache CXF" section at https://docs.jboss.org/author/display/JBWS/JBoss+Modules

            Basically, on AS 7 series, the user is responsible for setting dependencies to modules he want to use in his own deployment. The @SchemaValidation comes from the org.apache.cxf module, so you should be adding that in your MANIFEST.MF.

             

            Manifest-Version: 1.0

            Dependencies: org.apache.cxf

            • 3. Re: How to enable schema validation with JBoss 7
              nielsm

              Hi Alessio,

               

              Thanks for the response. I have tried to follow the instructions, but I'm still getting the "Cannot resolve resource: cxf" warning. But perhaps I'm not doing things right? I've added to my maven war plugin:

                    <archive>
                      <manifestEntries>
                          <Dependencies>
                          org.apache.cxf
                          </Dependencies>
                      </manifestEntries>
                    </archive>

              (I also tried with adding services and export). The resulting MANIFEST.MF (in META-INF) is:

              Manifest-Version: 1.0

              Archiver-Version: Plexus Archiver

              Created-By: Apache Maven

              Built-By: morvinie

              Build-Jdk: 1.6.0_27

              Dependencies: org.apache.cxf

               

              Have I misunderstood the instructions?

              • 4. Re: How to enable schema validation with JBoss 7
                nielsm

                Hi All,

                 

                Sorry, I was too hasty in my reply yesterday. Schema validation works fine with the above described solution. You still get the above "Cannot resolve resource: cxf" warnings (quite a few) at start up, but that is only a minor issue.

                 

                So, thank you Allessio.