My question is similar to this question, just that I am looking for SOAP JAVA client API based solution.

Suppose, I have a Parent object Account and it's child object Contact. I have a web application, that updates and creates the above objects using the SOAP API.

A typical use case may involve:

  1. Creating a new account and creating one or more contacts.
  2. Updating an account and adding one or more contacts.
  3. Updating an account and updating one or more contacts.

I would like the #2 and #3 above to happen within the same transaction. For instance, User updates and also adds a new contact in same session.

I want to use AllOrNoneHeader, so that the update to Account object and creation of new child Contact object happens within the same transaction.


The SOAP update API expects all the objects to have an ID. Therefore, I can not create a Contact within the same transaction i.e. in a single update call (that also updates account). If I split it into two steps i.e.

  • In the first step update the Account object
  • In the second step create the child Contact object

Then I loose the transaction support, quoting the relevant parts of documentation.

....It’s not possible to span a transaction across multiple API calls....

I can also not use upsert API, as I do not have external ID's in my object and as far I can tell it only works on objects of one type.


  1. What is the best way to update a parent record and create a child record within same transaction using SOAP API.

1 Answer 1


One option here is to create your own SOAP API using the WebService keyword in Apex.

This would allow you to perform all the required operations within one SOAP based transaction.

The signature of your new method can be created to either mirror that of the existing SOAP API to work on a collection of sObjects or be tailored to your specific need.

Another non-SOAP option is to use the REST API composite resources.

  • Thanks for the response, just to confirm, SOAP API does not support composite operations in a transaction i.e. create and update records within the transaction boundary, and the REST composite API or the custom webservice endpoints is my only option. May 2, 2017 at 7:44
  • 1
    @AnupamSaini Correct, the SOAP API doesn't have native support for the type of composite operations you want to perform. You can either make your own SOAP API to suit your exact requirements, or use the provided REST API resources. May 2, 2017 at 8:20

You must log in to answer this question.

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