+ Start a Discussion

Apex and Webservice and partner wsdl file

Hi friends,


I am connecting salesforce with salesforce using partner wsdl.I have been able to login to the destination org from the source org and then I am caling custom webservice and passing some parameters to it which will be mapped to the account object in the destination org and then record is inserted and inserted record id  is returned as response .


I am running this code anonymously.


My problem is that after making callout ,called web service is returning an Id as reponse successfully .However,When I try to see inserted record in destination org I do not see any record over there.I am not getting any error


Below given code has custom web service.I have taken this webservice exactly as given in the salesforce help.


Can somebody please suggests



partnerSoapSforceCom.Soap sp = new partnerSoapSforceCom.Soap(); /

String username = 'james@yahoo.com'; String password = 'jamesgalore';

partnerSoapSforceCom.LoginResult loginResult = sp.login(username, password); soapSforceComSchemasClassAccountpla.Accountplan apx=new   soapSforceComSchemasClassAccountpla.Accountplan(); soapSforceComSchemasClassAccountpla.SessionHeader_element SessionHeader=new soapSforceComSchemasClassAccountpla.SessionHeader_element(); sessionHeader.sessionid=loginResult.sessionid; apx.sessionheader=sessionHeader;

soapSforceComSchemasClassAccountpla.plan l=new soapSforceComSchemasClassAccountpla.plan(); l.name='Genius'; l.Plannumber=123456;



soapSforceComSchemasClassAccountpla.Plan opp=apx.createAccountPlan(l);

system.debug('The output after value has been returned by us is' + opp);

system.debug('The value of the vplan id is' + opp.planid);


catch(Exception e)



System.debug('The exception has been raised is'+e);





global class AccountPlan {
       webservice String area;
       webservice String region;
       //Define an object in apex that is exposed in apex web service
       global class Plan {
          webservice String name;
          webservice Integer planNumber;
          webservice Date planningPeriod;
          webservice Id planId;
       webservice static Plan createAccountPlan(Plan vPlan) {
           //A plan maps to the Account object in salesforce.com.
           //So need to map the Plan class object to Account standard object
           Account acct = new Account();
           acct.Name = vPlan.name;
           acct.AccountNumber = String.valueOf(vPlan.planNumber);
           insert acct;
           return vPlan;



Best Answer chosen by Admin (Salesforce Developers) 

it has been resolved.