The moose likes Web Services and the fly likes CXF supports wsdl 2.0? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "CXF supports wsdl 2.0?" Watch "CXF supports wsdl 2.0?" New topic

CXF supports wsdl 2.0?

Nira Amit

Joined: Aug 27, 2009
Posts: 2
hi all,
i'm trying to use wsdl2java by typing:
C:\dev\apache-cxf-2.2.3\bin>wsdl2java -wv 2.0 -p my.pkg -client -d src C:/my/service.wsdl
and all i get is

WSDLToJava Error: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

i did manage to generate code from this wsdl using axis2, but i want to use cxf because it lets you use xjc plugins (by passing parameters directly to the xjc).

any ideas? i've been googling for ages...
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
If this was my problem I would look at the full exception dump for the line in the CXF code where it hit the empty array causing this error.

Hopefully learning the identity of the array will help you figure out what is missing in your WSDL document.

Getting the source is a bit of a pain but this directory listing shows it.

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
You should be able to validate the WSDL document in Eclipse, NetBeans or an XML editor like Oxygene and, if no XML-related issues exist, it should pass validation. This will at least exclude errors in the format of the WSDL.
Best wishes!
Nira Amit

Joined: Aug 27, 2009
Posts: 2
hi guys, thanks for answering.
the wsdl has no errors, so i checked the latest code distribution (apache-cxf-2.2.3-src) as you suggested and here's what i found:
the problem is with a list called "serviceList" that is being filled in WSDLToJavaContainer by the following code:

List<ServiceInfo> serviceList = (List<ServiceInfo>)context.get(ToolConstants.SERVICE_LIST);
if (serviceList == null) {
serviceList = new ArrayList<ServiceInfo>();

// Build the ServiceModel from the WSDLModel
if (version == WSDLConstants.WSDLVersion.WSDL11) {
AbstractWSDLBuilder<Definition> builder = (AbstractWSDLBuilder<Definition>)frontend

// yada-yada-yada... doing more stuff...

} else {
// TODO: wsdl2.0 support

so basically, support for wsdl 2.0 is not implemented
but looking at the bug repository of the CXF project you see stuff like: https://issues.apache.org/jira/browse/CXF-48?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
which leads innocent people like me to believe that wsdl2.0 is supported...

anybody knows of a wsdl2java tool that supports wsdl2.0 AND lets you pass parameters to xjc?
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
I haven't tried myself, but the Axis2 webpage here claims WSDL 2.0 support: http://ws.apache.org/axis2/
Don't know if it also allows you to pass parameters to XJC...
Best wishes!
It is sorta covered in the JavaRanch Style Guide.
subject: CXF supports wsdl 2.0?
Similar Threads
Axis2 code generation for WSDL version 2.0
How to copy generated wsdl file to WAR file?
is there any alternative for ArrayList object in web services
Getting xml contents from wsdl2java class
Problem with CXF wsdl2java