You need to sign in to do that
Don't have an account?
problem with apex2wsdl and wsdl2apex: missing parameters/variables when using extended classes
(just moved this topic from another board, as it is apex related...)
I just stumbled upon a problem, when trying to expose a webservice which uses a derived class as a parameter. In that case, SF just exposes all variables of the child class itself, but no variables of the parent class as expected.
global class WebServiceTestExtension {
global virtual class Parent {
WebService String parentVariable;
}
global class Child extends Parent {
WebService String childVariable;
}
webService static String setParentAndChild(Child c){
return c.parentVariable + c.childVariable;
}
}
results in this wsdl (just an excerpt):
<xsd:complexType name="Child">
−
<xsd:sequence>
<xsd:element name="childVariable" minOccurs="0" type="xsd:string" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
−
<xsd:element name="setParentAndChild">
−
<xsd:complexType>
−
<xsd:sequence>
<xsd:element name="c" type="tns:Child" nillable="true"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
As you can see, any reference to Parent is missing.
Same happens in the other direction, when parsing a WSDL in SF which contains elements, which extend other elements. In this case, the extension is ignored, thus it is not possible to create a valid call to the external webservice. Even if this is a feature, which is not supported, I would expect an error message at least. Or am I missing something?
<xs:complexType name="parent">
<xs:sequence>
<xs:element name="parentvariable" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="child">
<xs:complexContent>
<xs:extension base="tns:parent">
<xs:sequence>
<xs:element name="childvariable" type="xs:dateTime"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
In this case in the respective Child class, there will be no reference to the parent.