2

I have a class generated from partner WSDL and i am trying to do a webservice call from salesforce one instance to other .How will i use the class generated below to make the call and have fields data mapped

/Generated by wsdl2apex

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','urn:sobject.partner.soap.sforce.com',null,'1','1','false'};
private String[] fieldsToNull_type_info = new String[]{'fieldsToNull','urn:sobject.partner.soap.sforce.com',null,'0','-1','true'};
private String[] Id_type_info = new String[]{'Id','urn:sobject.partner.soap.sforce.com',null,'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'};
  }
}

Here is what i tried so far,

PartnerSoapSforceCom.Soap   pc=new partnerSoapSforceCom.Soap ();
partnerSoapSforceCom.LoginResult res=pc.login('[email protected]','salesforce123');
system.debug('***'+res.sessionId);

//Create a new sObject of type Contact
   // and fill out its fields.
   sobjectPartnerSoapSforceCom.sObject_x acc= new       sobjectPartnerSoapSforceCom.sObject_x();
acc.type_x='Account';


 // Add this sObject to an array 
sobjectPartnerSoapSforceCom.SObject_x[] accs = new   sobjectPartnerSoapSforceCom.SObject_x[1];
accs[0] = acc;

 sobjectPartnerSoapSforceCom.sObject_x[] sbjs=accs;
partnerSoapSforceCom.SessionHeader_element header=new    partnerSoapSforceCom.SessionHeader_element();
 header.sessionId=res.sessionId;
 pc.SessionHeader=header;
 pc.create(sbjs);//Failed 
5
  • What error are you getting from pc.create(sbjs)? Commented Dec 20, 2013 at 18:20
  • @AndrewFawcett I am not able to get fields and value map.There are schema types of Any and that causes the issue . Commented Dec 20, 2013 at 18:30
  • What did the generated sObject_x class look like? Did the setField and getField have Object type or are you saying the methods are just missing? Commented Dec 22, 2013 at 11:36
  • @AndrewFawcett These were missing itself .The above code generated did not have getfield and setfield methods .I went ahead and used REST to connect two orgs . Commented Dec 22, 2013 at 12:49
  • Yep, was about to suggest REST API, lighter also in this case. Glad you've got things moving! :) Commented Dec 22, 2013 at 13:20

1 Answer 1

1

The Partner WSDL contains a number of schema types that are not supported by WSDL2Apex, you're going to have a really tough time getting this to work. An alternative approach like using Salesforce 2 Salesforce, or the REST API will be easier.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .