function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
FabianFabian 

Inheritance in Webservice Callout

Hey everybody,

 

I am trying to callout to a webservice that delivers a soap-response like following:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header/>
    <soapenv:Body>
        <ns1:getDataResponse xmlns:ns1="http://www.customer.com/namespace1">
            <ns1:Response>
                <ns1:SomeElement>
                    <ns1:ParentObjectType xsi:type="ns2:ChildObjectType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.customer.com/namespace2">
                        <SomeChildObjectProperty>
                            SomeChildObjectPropertyValue
                        </SomeChildObjectProperty>
                    </ns1:ParentObjectType>
                </ns1:SomeElement>
            </ns1:Response>
        </ns1:getDataResponse xmlns:ns1="http://www.customer.com/namespace1">
    </soapenv:Body>
</soapenv:Envelope>

 In apex, definition is as following (generated from wsdl with small changes):

public class Namespace1 {
    public class getDataResponse {
        ...
    }
    public class Response {
        ...
    }
    public class SomeElement {
        ...
    }
    //virtual was added manually
    public virtual class ParentObjectType {
        ...
    }
}

public class Namespace2 {
    //extends Namespace1.ParentObjectType was added manually
    public class ChildObjectType extends Namespace1.ParentObjectType {
        public String SomeChildObjectProperty;
        ...
    }
}

The problem is, that apex is unable to parse the webservice response and tells me, that "apextype for http://www.customer.com/namespace1=ParentObjectType cannot be found".

 

Any Ideas on this? I'm really confused, as anything else seems to work fine.