I have two Orgs, the service ORG and the client Org. I want to feed data from service ORG into client org.
I read from these two places:
Here's my steps:
In the Service Org:
Create the web service class
Download the WSDL file auto generated from this web service class
In the Client Org:
Import the WSDL file to generate apex classes. (One Async and one Sync);
Write apex to call the web service using generated apex method.
In step 4, I was not able to set a correct session ID for the service client. Did I miss any steps?
Code of Step 4:
ARTaskWebService.AR_getActivitiesWebservice client=new ARTaskWebService.AR_getActivitiesWebservice(); client.SessionHeader = new ARTaskWebService.SessionHeader_element(); client.SessionHeader.sessionId=???? List<ARTaskWebService.ARActivity> activities = client.getActivities('Client Name'); System.debug(activities.size());
I tried to use the partner wsdl of Service Org to generate the login method in Client Org and get the session ID by calling the login method. But I got an error "WebService returned a SOAP Fault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: "