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

fail to create a service model from class when: BARE parameter style, XmlBeans data binding, XmlBeans' source is WSDL file

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.1.7, 2.2.4
    • Component/s: OtherDatabindings
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      SCENARIO:

      1. Given WSDL with data types defined inside (imports are not used).
      2. Generate service interface and xml beans.
      3. Create a client proxy using ClientProxyFactoryBean:

      • use BARE parameter style;
      • use XmlBeans data binding;
      • do not specify WSDL location.

      ACTUAL RESULT:

      Exception in thread "main" org.apache.cxf.service.factory.ServiceConstructionException: Service class org.example.MyService method queryMethod part

      {http://example.org/services/myservice}

      arg0 cannot be mapped to schema. Check for use of a JAX-WS-specific type without the JAX-WS service factory bean.
      at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.createBareMessage(ReflectionServiceFactoryBean.java:1090)
      at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:392)
      at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:444)
      at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:195)
      at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
      at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:52)
      at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102)
      at org.example.services.MyServiceClient.main(MyServiceClient.java:52)

      EXPECTED RESULT:

      Successful creation of a client proxy.

      ANALYSIS:

      When the service model is build from the class the XmlBeansSchemaInitializer.mapClass() method is executed for web service data types.

      The method contains the following condition:

      if (sourceName.endsWith("wsdl"))

      { return; }

      Our source is WSDL with data types defined inside (imports are not used), so the MessagePartInfo attributes are not fully populated due to this condition. These attributes are missed and ReflectionServiceFactoryBean.createBareMessage() throws the exception.

      I assume the condition should be removed and the logic should be updated to take into account definitions of data types contained in WSDL.

        Attachments

        1. XmlBeansSchemaInitializer.java
          12 kB
          Michael Klimiuk

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              mklimiuk Michael Klimiuk
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: