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
r3rr3r 

Web services

Hi All,

 

I am trying webservice from salesforcce to salesforce

 

I place wsdl of one salesforce sandbox and I call it by "generate from wsdl" and created parse wsdl

 

I wrote class for delete in appex

 

I pass

partnerSoapSforceComWrapper.delete_x(new List<Id> { 'leadid' }, 'username', 'password'); in developer console and execute it IT Is SUCCESSFULLY DELETED LEAD

 

Now For Update

 

I wrote a class

public class partnerSoapSforceComWrapperupdate {
public static Boolean update_x( sobjectPartnerSoapSforceCom.sObject_x[]  sObjects , String username, String password)
    {
       Boolean success = false;
       partnerSoapSforceCom.Soap stub = new partnerSoapSforceCom.Soap();
       partnerSoapSforceCom.LoginResult loginResult =stub.login(username, password);
       stub.endpoint_x = loginResult.serverUrl;
       stub.SessionHeader = new partnerSoapSforceCom.SessionHeader_element();
       stub.SessionHeader.sessionId = loginResult.sessionId;
       partnerSoapSforceCom.saveResult[] Result =stub.update_x( sObjects );
       success = true;
       return success;
   }
}

 

But When I am Trying to pass sobject in developer console it is not accepting

 

Please Help me how to update Xrecord of Some xsalesforce

 

Avidev9Avidev9

Just have a look at the signature of the update class, It is expecting "sobjectPartnerSoapSforceCom.sObject_x[]" it is not same as the Sobject that we use in general.

This is a class "Sobject_x" which you can find inside "sobjectPartnerSoapSforceCom" class generated by wsdl.

Hope this helps.

r3rr3r
Thanks,

I know the class.I check it ,Can you send small code to update record which
use in developer console please help me.
Avidev9Avidev9
Can you please post your class here?. That would be really helpful.
r3rr3r
public class sobjectPartnerSoapSforceCom {
public class sObject_x {
public String type_x;
public String[] fieldsToNull;
public String Id;
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[] 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'};
}
}
Avidev9Avidev9
Ahh I remember the problem now.
You wont be able to pass the fields directly to the webservice, since many
features of WSDL are not supported and hence a proper generic class is not
generated. you may have to hardcode the fields in the class generated by
wsdl. I wont suggest that.

What you can do is you can USE the REST API or define your own custom
webservice class to do the update.
r3rr3r
Thanks,

can i use in this way in developer console

clas name(field name,username,password)