1

I am working on a application where I need to use salesforce data replication api to get deleted/updated record id but this facility is available through SOAP api and examples are provided in java/c#. I have to Implement the same in python which I did in bulk api data but for data replication methods like getUpdated or getDeleted I have to use external library like zeep using salesforce provided WSDL xml file.

Using WSDL is fine I am getting all services but to Implement the subsequent services we need to pass sessionHeader and serverUrl which we received from login api, I can successfully set the session header using set_default_soap_header but unable to set the serverURL thing. The soap header function from WSDL throws exception of SessionHeader signature If I passed the serverUrl.

From salesforce doc, I refer this java example to check the url attribute to set the serverUrl from login response but didn't succeed using soap client in python.

Am I misguided or headed in wrong direction ?.

0

If you prefer to work with REST APIs in Python, the REST API provides equivalent endpoints:

Communicating with these endpoints shouldn't require any additional libraries (other than whatever you're already using, like simple_salesforce or requests).

  • Yes this one is pretty straightforward through rest, though it's not available on simple_salesforce but it provides fruitful information require by updated and deleted api endpoints. Thank you very much! – Shashank Mar 9 at 8:18
  • You can often use the restful() method in simple_salesforce to call other APIs that aren't explicitly supported. – David Reed Mar 9 at 12:08
0

The SOAP login method will return a serverURL that is appropriate for further usage with the API that you logged into.

More likely than not, you performed the login() call against the Partner API.

The resulting serverURL would have been something like:

https://na1.salesforce.com/services/Soap/u/45/00D300000000001

The na1 would have been changed to your specific pod, or even your custom MyDomain setting.

This serverURL is important, as all subsequent API requests need to go there instead of https://login.salesforce.com/services/Soap/u/45.0/ I.e. You don't pass the serverURL to Salesforce in the headers. It is the endpoint that you communicate via.

I'll admit to knowing next to nothing about how to reconfigure the SOAP endpoint in Python. However, I found Change Service URL in Python Zeep, which seems like it should be applicable here. You need to create a new ServiceProxy object using the endpoint defined in the serverURL.

  • Thanks for help, let me go through with proxy object. – Shashank Mar 9 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.