2

I've generated an Apex class based on the Metadata WSDL file I got from my org. I call the readMetadata function and while the response received contains all the data I want, the callout fails because of 'Apex type not found for element language'. What is missing from the generated code that it can't parse responses?

The response looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <readMetadataResponse>
            <result>
                <records xsi:type="CustomLabel">
                    <fullName>Accepted</fullName>
                    <language>en_US</language>
                    <protected>true</protected>
                    <shortDescription>Accepted</shortDescription>
                    <value>Accepted</value>
                </records>
                <records xsi:type="CustomLabel">
                    <fullName>Rejected</fullName>
                    <language>en_US</language>
                    <protected>true</protected>
                    <shortDescription>Rejected</shortDescription>
                    <value>Rejected</value>
                </records>
            </result>
        </readMetadataResponse>
    </soapenv:Body>
</soapenv:Envelope>

1 Answer 1

2

Andrew Fawcett has done a lot of work on using this API from Apex. Some of the issues are listed in his Challanges calling the Metadata API from Apex, such as polymorphic types that the Apex WSDL tooling can't handle.

So rather than the WSDL emitted by an org, that financialforcedev/apex-mdapi Git project is the best place to start.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .