Posts Tagged “web services”

Had some problems when trying to get Flex to invoke my Xfire Web Service. The culprit <xsd:any>. I don’t have the exact reason but i think Flex will try read the WSDL and attempt to decipher each soap message structure. <xsd:any> becomes a null. I get the error “No such property null… on com.myCustomObject”.

By default, Xfire will not generate the <xsd:any> in the WSDL but i have a complexType of a ValueObject in another ValueObject type. Strangely, it generates the <xsd:any>. My only clue is on the Xfire jira. The solution is there but i think i should let everyone know that the fix for the bug #295 only works for a normal valueObject. For my case, it doesn’t work.

My saviour: the extensibleElements, and extensibleAttributes flags.(Source) There should be some mention about this on the Xfire website.

Example codes:

import org.codehaus.xfire.aegis.type.java5.XmlElement ;
import org.codehaus.xfire.aegis.type.java5.XmlType;
@XmlType(name="A", extensibleElements=false, extensibleAttributes=false)
public class A {
	public int var1;

	@XmlElement(name="Var1")
	public int getVar1() {

		return var1;

	}

	public void setVar1(int var1) {

		this.var1 = var1;
	}

}

Generated WSDL:

<xsd:complexType name=”A>

<xsd:element minOccurs=”0 name=”Var1 nillable=”true type=”xsd:int />

</xsd:sequence>
</xsd:complexType >

Comments Comments