I am trying to connect to other salesforce org. I have partner wsdl. I have used FuseIT SFDC explorer to create Apex class from this partner wsdl. I am successfully able to login to other SF org using login() call. But my query() call is failing with error -
Web service callout failed: Unable to parse callout response. Apex type not found for element MyCustomField__c
Looks like this has to do with sObject_x class created by FuseIT SFDC explorer.
Below is the code which makes query() call,
partnerSoapSforceCom.Soap partnerObj = new partnerSoapSforceCom.Soap();
//login here and login is successful
partnerSoapSforceCom.QueryResult qresult = partnerObj.query('select Id, MyCustomField__c from MyCustomObject__c');
system.debug('resule size - ' + qresult.size );
Below is QueryResult class created by the tool,
public class QueryResult {
public Boolean done;
public String queryLocator;
public sobjectPartnerSoapSforceCom.sObject_x[] records;
public Integer size;
private String[] done_type_info = new String[]{'done','urn:partner.soap.sforce.com','boolean','1','1','false'};
private String[] queryLocator_type_info = new String[]{'queryLocator','urn:partner.soap.sforce.com','QueryLocator','1','1','true'};
private String[] records_type_info = new String[]{'records','urn:partner.soap.sforce.com','sObject','0','-1','true'};
private String[] size_type_info = new String[]{'size','urn:partner.soap.sforce.com','int','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:partner.soap.sforce.com','true','false'};
private String[] field_order_type_info = new String[]{'done','queryLocator','records','size'};
}
Below is the sObject_x class created by the tool,
public class sobjectPartnerSoapSforceCom {
//Warning: '<xsd:any>' element type has been changed to dataType List<DOM.XmlNode> called anyElement
public class sObject_x {
public String type_x;
public String[] fieldsToNull;
public String Id;
public List<DOM.XmlNode> anyElement;
private String[] type_x_type_info = new String[]{'type','urn:sobject.partner.soap.sforce.com','string','1','1','false'};
private String[] fieldsToNull_type_info = new String[]{'fieldsToNull','urn:sobject.partner.soap.sforce.com','string','0','-1','true'};
private String[] Id_type_info = new String[]{'Id','urn:sobject.partner.soap.sforce.com','ID','1','1','true'};
private String[] anyElement_type_info = new String[]{'anyElement','urn:sobject.partner.soap.sforce.com','List<DOM.XmlNode>','0','1','true'};
private String[] apex_schema_type_info = new String[]{'urn:sobject.partner.soap.sforce.com','true','false'};
private String[] field_order_type_info = new String[]{'type_x','fieldsToNull','Id','anyElement'};
}
}
any idea what is causing this error ?