Monday, March 15, 2010

apache CXF and .NET

I had some troubles finding out why .NET (3.5 RC1) svcutil wasn't able to invoke my java CXF web service. Hope this may help you.

The error was:

exception = {"There was an error reflecting 'return'."} InnerException = {"The Form property may not be 'Unqualified' when an explicit Namespace property is present."}

It turned out that (besides mandatory namespaces) it was also caused by the fact svcutil doesn't like encoding arrays/lists as:

<xs:element form="qualified" maxoccurs="unbounded" minoccurs="0" name="linkedGroups" type="tns:group">

but it requires a nested element:

<xs:element form="qualified" minOccurs="0" name="linkedGroups">
        <xs:element form="qualified" maxOccurs="unbounded" minOccurs="0" name="item" type="tns:group"/>

This can be accomplished with the following jaxws annotations:

@XmlElementWrapper(namespace = "", name = "linkedGroups")
@XmlElement(namespace = "", name = "item")
public List<Profile> getLinkedGroups() {
  return linkedGroups;

This blog helped me