Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4113

Header fields duplication in generated wsdl file when using aegis databinding

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      CXF generates invalid wsdl for jax-ws annotated interfaces when using aegis databinding.

      Problem is in generating schema for methods which have parameters annotated with @WebParam( name='...', header=true).
      Such parameters are being duplicated in generated wsdl. For example:

      ...
        <xsd:element name="buggyWsdlDef" type="buggyWsdlDef"/>
        <xsd:complexType name="buggyWsdlDef">
          <xsd:sequence>
            <xsd:element minOccurs="0" name="userName" nillable="true" type="xsd:string"/>
          </xsd:sequence>
        </xsd:complexType>
        <xsd:element name="firstHeader" type="xsd:int"/>
        <xsd:element name="secondHeader" type="xsd:string"/>
        <xsd:element name="firstHeader" nillable="true" type="xsd:int"/>
        <xsd:element name="secondHeader" nillable="true" type="xsd:string"/>
        <xsd:element name="buggyWsdlDefResponse" type="buggyWsdlDefResponse"/>
      ...
      

      This causes some clients totally not to work with such web service(soap ui doesn't complain somewhy).
      Eclipse wsdl validator gives me this error:
      "A schema cannot contain two global components with the same name; this schema contains two occurrences of 'http://service.common.example.com/,firstHeader'.

      My investigation shows that:
      1. This problem appears only when using aegis databinding.
      2. This bug presented in versions which are >= 2.4.0 (last version without this bug is 2.3.9)
      3. This happens only in wsdl that is being generated for importing through wsdl:import directive.
      In my case original wsdl is <ws-url>/service?wsdl and one that is imported is <ws-url>/service?wsdl=ExampleService.wsdl
      4. Debugging shows that problem is probably in ReflectionServiceFactoryBean. When service is starting, next chain of methods is called: buildServiceFromClass->...initializeParameter[many times]->...initializeWrappedSchema[many times]

      initializeWrappedSchema method calls checkForElement(...) which adds duplications for header parameters in service object model(ServiceInfo instance).
      Not sure why exactly this happens but hope that it will help you at least locate the problem.

      I'm attaching maven project which demonstrates this problem.

      In order to reproduce this bug using sample project attached:
      1. "mvn jetty:run" in project directory
      2. Open localhost:8080/CXFExampleService/service?wsdl=ExampleService.wsdl in the browser

      Search for '<xsd:complexType name="buggyWsdlDef">' occurence in that wsdl.

      Attachments

        1. cxfaegisbug.zip
          8 kB
          Artur Ashyrov

        Activity

          People

            dkulp Daniel Kulp
            artur.ashyrov Artur Ashyrov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: