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

Salesforce Partner WSDL

Can salesforce partner wsdl be used to make API calls from one org to other?


ya u have to use that when u want to make a api call from one organization to other org....




partnerSoapSforceCom.soap con = new partnerSoapSforceCom.soap();
con .SessionHeader = new partnerSoapSforceCom.SessionHeader_element ();
partnerSoapSforceCom.loginResult  loginResult = new partnerSoapSforceCom.loginResult();
loginResult =con.login('********************','*****************************');
con.endpoint_x =loginResult.ServerUrl;
con.Sessionheader.sessionid = loginResult.sessionid;
partnerSoapSforceCom.queryResult qr = new partnerSoapSforceCom.queryResult ();
qr=con.queryAll('SELECT Id,Name FROM Contact Limit 1');
catch(Exception e)






Web service callout failed: Unable to parse callout response. Apex type not found for element






I tried using the Partner Wsdl login was successful.

I can query ID on any object but when i am including other fields it is give the above error


Could be off, but may need to check the sharing/security of the object and associated WSDL (if you've written a class for it).


I am facing the same problem .The object permission is Read/Write and public but still getting below error


System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element


Did anyone get solution with this ?

Kevin BromerKevin Bromer

This is how I fixed it for my SF callout:


A QueryResult object is generated as part of the callout that has an element that is a list of sobjects, called sobject_x (since there's reserved word clash), so in my sobject_x subclass in my main WSDL-generated class (in this case 'PartnerMatrixWS') I add a new variable for each field I'm calling out for. Here's, I've added the Account 'BillingCity':


 public class sObject_x {
        public String type_x;
        public String[] fieldsToNull;
        public String Id;
        public String BillingCity;
        private String[] type_x_type_info = new String[]{'type','','string','1','1','false'};
        private String[] fieldsToNull_type_info = new String[]{'fieldsToNull','','string','0','-1','true'};
        private String[] Id_type_info = new String[]{'Id','','ID','1','1','true'};
        private String[] BillingCity_type_info = new String[]{'BillingCity','','ID','1','1','true'};
        private String[] apex_schema_type_info = new String[]{'','true','false'};
        private String[] field_order_type_info = new String[]{'type_x','fieldsToNull','Id'};

 With the newly added lines being:


        public String BillingCity; 
        private String[] BillingCity_type_info = new String[]{'BillingCity','','ID','1','1','true'};

 Now, when I iterate through the sobject_x that are returned by the QueryResult, I can reference them directly as a property:


string soqlStatement = 'select id, BillingCity from Account'
    	PartnerMatrixWS.QueryResult qr =new PartnerMatrixWS.QueryResult();
    	qr = pmwsSOAP.query(soqlStatement);
    	for (PartnerMatrixWS.sObject_x obj : qr.records){
            system.debug('BillingCity===============:  ' + obj.BillingCity);


Which prints out the BillingCity returned in the query in the debug log.






I tried this also but for this we have to hardcode the fields. Since we want to use partner wsdl I guess it isnt wise.


I am also at the same point now.. I was able to query the Account object by adding new fields in sobject_x class.

But as mentioned above, since we are using Partner WSDL , we should have a way to use generic fields.instead of any specific Object.


It would be great if there is a way to solve this problem.


Otherwise, it is not possible to use this concept for all objects...




Curious if there were any elegant solutions found for the issue detailed here?