You need to sign in to do that
Don't have an account?
SrikanthKuruva
Web service callout failed: Unable to parse callout response. Apex type not found for element
Hi All,
Following is the error that i have been facing
"System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element".
i have the class defined for the element being pointed out in the above error. And also i dont have any invalid types in the wsdl like <s:any .... . So can you please let me know if there are any such points that needs to be checked?
Thanks
Srikanth
use the SoapUI tool to test your web service for proper handling..
SoapUI is just a google search away.
it is not free, but there is a trial use period..
Sam
yes the soap UI tool is giving me proper soap response but in SFDC along with the soap response i am getting the callout exception as "Web service callout failed: Unable to parse callout response. Apex type not found for element...."
can u post your web service's WSDL?
SF doesn't support Soap 1.2 which might be causing this problem..
there is an Idea posted about this
http://success.salesforce.com/ideaview?id=08730000000BroSAAS
Error message: Web service callout failed: Unable to parse callout response. Apex type not found for element externalId
Here's the raw soap response up until the point of failure
<?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="CustomField">
<fullName>Case.Custom_Field__c</fullName>
<externalId>false</externalId>
And the apex classes for the parsing
public class readMetadataResponse_element {
public SFDC_API_MetaData.ReadResult result;
private String[] result_type_info = new String[]{'result','http://soap.sforce.com/2006/04/metadata','ReadResult','1','1','false'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
private String[] field_order_type_info = new String[]{'result'};
}
public class ReadResult {
public SFDC_API_MetaData.Metadata[] records;
private String[] records_type_info = new String[]{'records','http://www.w3.org/2001/XMLSchema','Metadata','0','-1','false'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
private String[] field_order_type_info = new String[]{'records'};
}
public virtual class Metadata {
public String fullName;
private String[] fullName_type_info = new String[]{'fullName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://soap.sforce.com/2006/04/metadata','true','false'};
private String[] field_order_type_info = new String[]{'fullName'};
}
public class CustomField extends Metadata {
public String type = 'CustomField';
public String fullName;
[...]
public Boolean externalId;
[...]
private String[] type_att_info = new String[]{'xsi:type'};
[...]
private String[] externalId_type_info = new String[]{'externalId','http://www.w3.org/2001/XMLSchema','boolean','0','1','false'};
[...]
}
If I add "public boolean externalId;" to the Metadata class the error changes to the next "missing" field, which means that the parser is trying to create Metadata instances instead of CustomField instances. I think the instruction to create CustomField instances is in the "xsi:type='CustomField'" attribute of the <records> tag, which uses a different namespace (which you can see I've been fiddling with).
public class ReadResult {
public SFDC_API_MetaData.Metadata[] records;
private String[] records_type_info = new String[]{'records','http://www.w3.org/2001/XMLSchema','Metadata','0','-1','false'};
[...]
to
public class ReadResult {
public SFDC_API_MetaData.CustomField[] records;
private String[] records_type_info = new String[]{'records','http://www.w3.org/2001/XMLSchema','CustomField','0','-1','false'};
[...]
This means that each new read result query needs it's own classes to handle the response, but the use case we're solving focusing exclusively on custom fields.