You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Matti Bickel <mb...@demandware.com> on 2015/09/22 15:55:48 UTC

AssertionError when providing both empty type definition and globalBinding to wsdl2java

Hi,

I've got a problem trying to generate a Java webservice out of a WSDL file I got from a 3rd party. It boils down to these test-case:

test.wsdl:
<?xml version="1.0"?>
<definitions name="StockQuote"
             targetNamespace="http://example.com/stockquote.wsdl"
             xmlns:tns="http://example.com/stockquote.wsdl"
             xmlns:xsd='http://www.w3.org/2001/XMLSchema'
             xmlns:xsd1="http://example.com/stockquote.xsd"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
  </types>

  <message name="GetLastTradePriceInput">
    <part name="body" type="xsd:string"/>
  </message>

  <message name="GetLastTradePriceOutput">
    <part name="body" type="xsd:string"/>
  </message>

  <portType name="StockQuotePortType">
    <operation name="GetLastTradePrice">
      <input message="tns:GetLastTradePriceInput"/>
      <output message="tns:GetLastTradePriceOutput"/>
    </operation>
  </portType>

  <binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="GetLastTradePrice">
      <soap:operation soapAction="http://example.com/GetLastTradePrice"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>

  <service name="StockQuoteService">
    <documentation>My first service</documentation>
    <port name="StockQuotePort" binding="tns:StockQuoteSoapBinding">
      <soap:address location="http://example.com/stockquote"/>
    </port>
  </service>
</definitions>

jaxb_bindings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings version="2.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:ext="http://xml.w-wins.com/xjc-plugins/interfaces"
    jaxb:extensionBindingPrefixes="xjc">

    <jaxb:globalBindings generateElementProperty="false" choiceContentProperty="true" typesafeEnumMaxMembers="1500">
    </jaxb:globalBindings>
</jaxb:bindings>

Now, when I run wsdl2java like this:
​mbickel@neptun ~ $ apache-cxf-2.7.17/bin/wsdl2java -b ./jaxb_bindings.xml -d /tmp -compile -autoNameResolution -frontend jaxws21 ./test.wsdl

I get this output:
Exception in thread "main" java.lang.AssertionError
at com.sun.tools.xjc.reader.internalizer.DOMForest.getOneDocument(DOMForest.java:230)
at com.sun.tools.xjc.reader.internalizer.Internalizer.move(Internalizer.java:431)
at com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:160)
at com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:109)
at com.sun.tools.xjc.reader.internalizer.DOMForest.transform(DOMForest.java:449)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:231)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95)
at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:462)
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)
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)

Which apparently is caused by DOMForest not including the empty <types></types> definition, so the Internalizer doesn't have anyplace to move the global bindings.
I can work-around this by not providing a jaxb:globalBindings or providing a (useless) type definition in the wsdl.

Now the question is: is this something CXF can work-around for me or even a bug that can be fixed?

Thanks, Matti


This e-mail message and all attachments transmitted with it may contain privileged and/or confidential information intended solely for the use of the addressee(s). If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, forwarding or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message, all attachments and all copies and backups thereof.