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
Avi646Avi646 

Salesforce Partner WSDL

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

kiranmutturukiranmutturu

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

Avi646Avi646

 

CODE:

try{
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');
System.debug('------'+qr);
}
catch(Exception e)
{
System.debug(e.getMessage());
}

 

 

 

Error:

 

Web service callout failed: Unable to parse callout response. Apex type not found for element urn:sobject.partner.soap.sforce.com=Name

 

 

 

 

Avi646Avi646

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

JD2010JD2010

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).

SFvickSFvick

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 urn:sobject.partner.soap.sforce.com=Name

 

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','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
        private String[] fieldsToNull_type_info = new String[]{'fieldsToNull','http://www.w3.org/2001/XMLSchema','string','0','-1','true'};
        private String[] Id_type_info = new String[]{'Id','urn:partner.soap.sforce.com','ID','1','1','true'};
        private String[] BillingCity_type_info = new String[]{'BillingCity','urn:partner.soap.sforce.com','ID','1','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'};
    }

 With the newly added lines being:

 

 
        public String BillingCity; 
        private String[] BillingCity_type_info = new String[]{'BillingCity','urn:partner.soap.sforce.com','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.

HTH-

Kevin

 

 

Avi646Avi646

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.

ChellappaChellappa

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...

 

Regards,

Chellappa

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