"Attribute group must have ref name set" when generate an OTA CXF Web Service Client

1.3k views Asked by At

I am generating a web service client from published WSDL using Apache CXF runtimes

This WSDL has been generated across XDS provided by Open Travel Org (OTA) I am sure that it's correct but I put here likewise.

My problem is that I get this error message by CXF console when use the "Create Web Service" tool of Eclipse Kepler (using CXF runtimes 2.7.10 and java 7u71): Attribute group must have ref name set

    WSDLToJava Error: java.lang.RuntimeException: org.apache.ws.commons.schema.XmlSchemaSerializer$XmlSchemaSerializerException: Attribute group must have ref name set

    org.apache.cxf.tools.common.ToolException: java.lang.RuntimeException: 
    org.apache.ws.commons.schema.XmlSchemaSerializer$XmlSchemaSerializerException:
    Attribute group must have ref name set
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:420)
        at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
    Caused by: java.lang.RuntimeException: 
    org.apache.ws.commons.schema.XmlSchemaSerializer$XmlSchemaSerializerException: 
    Attribute group must have ref name set
        at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.addSchemas(JAXBDataBinding.java:642)
        at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:443)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:714)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:270)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
... 4 more
    Caused by: 
    org.apache.ws.commons.schema.XmlSchemaSerializer$XmlSchemaSerializerException: Attribute group must have ref name set
        at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeAttributeGroupRef(XmlSchemaSerializer.java:562)
        at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeAttributeGroup(XmlSchemaSerializer.java:523)
        at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeSchemaChild(XmlSchemaSerializer.java:2406)
        at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeSchemaElement(XmlSchemaSerializer.java:1659)
        at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeSchema(XmlSchemaSerializer.java:132)
        at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.addSchemas(JAXBDataBinding.java:640)
... 9 more

By the Tomcat Console appair a very long stachtraces with "Connection reset by peer: socket write error" errors

Whe WSDL to deploy is the follow:

    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions 
            name="OTA_VehAvailRateService" 
            xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
            xmlns:xs="http://www.w3.org/2001/XMLSchema"      

            targetNamespace="http://www.opentravel.org/OTA/2003/05"
            xmlns:ota="http://www.opentravel.org/OTA/2003/05">

        <wsdl:types>
            <xs:schema>
                <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="OTA_VehAvailRateRQ.xsd" />
            </xs:schema>
            <xs:schema>
                <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="OTA_VehAvailRateRS.xsd" />
            </xs:schema>        
        </wsdl:types>

      <wsdl:message name="OTA_VehAvailRateRequest"> 
        <wsdl:part element="ota:OTA_VehAvailRateRQ" name="parameters"/>
      </wsdl:message>
      <wsdl:message name="OTA_VehAvailRateResponse">
        <wsdl:part element="ota:OTA_VehAvailRateRS" name="parameters"/>
      </wsdl:message>

      <wsdl:portType name="OTA_VehAvailRatePortType">
        <wsdl:operation name="OTA_VehAvailRateAction">
          <wsdl:input message="ota:OTA_VehAvailRateRequest"/>
          <wsdl:output message="ota:OTA_VehAvailRateResponse"/>
        </wsdl:operation>
      </wsdl:portType>  

      <wsdl:binding name="OTA_VehAvailRateSOAPBinding" type="ota:OTA_VehAvailRatePortType">
        <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

        <wsdl:operation name="OTA_VehAvailRateAction">
          <soap12:operation soapAction="OTA_VehAvailRateSoapAction" style="document"/>

          <wsdl:input>
            <soap12:body use="literal"/>
          </wsdl:input>

          <wsdl:output>
            <soap12:body use="literal"/>
          </wsdl:output>

        </wsdl:operation>
      </wsdl:binding> 


      <wsdl:service name="OTA_VehAvailRateService">
        <wsdl:port name="OTA_VehAvailRatePort" binding="ota:OTA_VehAvailRateSOAPBinding">
          <soap12:address location="http://172.26.0.40:85/WebServiceAmadeus/services/OTA_VehAvailRatePort"/>
        </wsdl:port>
      </wsdl:service>   

    </wsdl:definitions>

UPDATE:

I don't think that cause be the schema definition because:

  • The schema is provided by OTA (International standard of Web Services for Traveling brokers)
  • If I use a local address of the same workspace to deploy the web service client, then works well. I.e:

Instead to use:

    http://172.26.0.40:85/WebServiceAmadeus/services/OTA_VehAvailRatePort?wsdl

I use:

    /WebServiceAmadeus/WebContent/wsdl/KarveOta.wsdl

Where WebServiceAmadeus is an project folder of the same workspace.

Of course this is not the solution because only can work in locale host.

UPDATE

I have try with other CXF versions (2.4.2, 3.0.2, etc) with the same problem. I have try with SOAP version 1.1 with the same problem. From SOAP UI 5.0.0, I can deploy get the request, but response say Unmarshalling Error: ?

4

There are 4 answers

2
jasso On

This is probably an error in your XML Schema. Check does it use <xs:attributeGroup> element to refer to some globally defined attribute group, and if it does, does the element have ref attribute.

0
ms_rahman On

Apache xmlschema-core library version 2+ causes the following exception when generating dynamic wsdl from OTA xsd files by Spring-ws.

org.apache.ws.commons.schema.XmlSchemaException:

Attribute group must have ref name set

Using spring-xml.2.0.5.RELEASE (max) with XmlSchema.1.4.7 will solve wsdl generation problem even with inline value="true"

<dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-xml</artifactId>
    <version>2.0.5.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.apache.ws.commons.schema</groupId>
    <artifactId>XmlSchema</artifactId>
    <version>1.4.7</version>
</dependency>
0
David OLMETA On

The problem comes from XSD files of OTA standard, for some versions, for which the namespace and targetnamespace are not defined.

For example :

  • for 2006a version, all is fine
  • for 2005b verson, namespace and targetnamespace are missing

I consider it is a bug in some definitions, so I add missing data, keeping patches...

The library XmlSchema is an old lib which is conflicted with others in my project.

1
Oleg On

Issue the same problem with OTA. I am using spring ws, and for me problem was solved when i add

<property name="inline" value="false"/>

in

org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection