Techiio-author
Started by Jofar ArcharNov 9, 2021

Open
Salesforce: SOAP Login from Salesforce TO Salesforce

2 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 2 VIEWES SHARE

I carried out a batch job that makes a webservice call inside the equal salesforce instance, which then is supposed to send emails with a pdf attachment since you can't send pdf attachments without delay from a batch process. My web service call looks like this:

public static void callOut(List ids){ 
        InvoiceAttachmentConnector.InvoiceAttachmentService ws = new InvoiceAttachmentConnector.InvoiceAttachmentService(); 
        ws.SessionHeader = new InvoiceAttachmentConnector.SessionHeader_element(); 
        ws.SessionHeader.sessionId = UserInfo.getSessionId(); 
        ws.handleInvoicePdfAttachment(ids); 
    }

But in batch jobs userinfo.Getsessionid() returns null, consequently i am getting a invalid_session_id exception.

1 Replies

Techiio-commentatorMorrison Oak replied 5 months ago0 likes0 dislikes

You can not get a consultation identification like this in batch apex because it runs underneath the machine context and so has no specific personal data for retrieval.

Update

You have got the following alternatives:

Attempt running the web services WSDL from your salesforce org through the WSDL to apex generator in your org to generate a few lessons which could let you log in. You are only allowed one internet carrier request consistent with executing the decision.

You can create a website's web page that you make an http get request to on your batch apex. This wishes to retrieve the ids of the objects you need to ship the pdfs for and a particular user to run to use the gadget.Runs(user) technique. You could pass these parameters inside the HTTP request header or a custom putting.

You must be Logged in to reply
Trending Technologies
15
Software91
DevOps48
Frontend Development24
Backend Development20
Server Administration17
Linux Administration28
Data Center24
Sentry24
Terraform23
Ansible83
Docker70
Penetration Testing16
Kubernetes21
NGINX20
JenkinsX17
Recommended Blogs
1
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance