Emiel Bruijntjes

How to improve your SOAP API connection

Written by Emiel Bruijntjes on

In this article we will give an overview of improvements you can make while using the SOAP API to connect to Copernica Marketing Software. These improvements will help you reduce the number of calls you have to make thus increasing the speed of the information exchange. The improvements in this article are based on the most common mistakes made by developers and should help you on your way for an optimal use of your SOAP API connection.


The fastest request is a request that isn't done. So make sure you cache as much data as possible. This is especially true for the WSDL file because it's quite large. If you are using PHP as a programming language and using the built-in SoapClient class, give the WSDL_CACHE_BOTH option to the constructor to let the object cache the WSDL file.

Updating (sub)profiles

When updating (sub)profiles there's no need to search for the (sub)profile first. If you add the requirements parameter to the 'updateProfiles' or 'updateSubprofiles' call, like the search call, the (sub)profiles that match the requirements will be updated. It's also possible to create a new sub(profile) if no match is found for the requirements. Just add the 'create' parameter with a non-zero value and a new (sub)profile will be created.


When searching for a profile in a database you usually want to know the contents too. We often see a call to 'Database_searchProfiles' to find the profiles, followed by a call to 'Profile_fields' to get the data of the profile. However the call 'Database_searchProfiles' has the parameter 'allproperties'. When this parameter is given and set to a non-zero value the 'Database_searchProfiles' returns all the properties of the found profiles instead of only the profile ID's. This is also the case for the 'Collection_searchSubProfiles' call.

'allproperties' parameter

All the requests that return a collection also have the parameter 'allproperties' in the request. If this parameter evaluates to true the response will be filled with the contents of the collection and not only the id's of the elements in the array. This can save a lot of calls to get the data of the elements in the collection. Only use this parameter if you need the database because this parameter slows the call on the server site.

Store session cookies

It's quite expensive to login for every request you make. So make sure you store the session cookie to prevent login on each request. The new PHP SOAP client example code does this automatically for you.


As of version 2.12 of Copernica Marketing Software it is be possible to request the SOAP response in gzip encoding. This reduces the size of the response from the server to the client. To make use of this feature you must send the Accept-Encoding: gzip in your http-header.

Asynchronous calls

Often it isn't necessary to wait for the response of a request sent to the server. You can use one of the example clients available for PHP to make asynchronous calls to the SOAP server. If for example you need to add multiple subprofiles to a profile, you can start all the requests at the same time. If you're not interested in the result, you can continue without waiting for the request to complete. Otherwise you can choose which requests to wait for.

Indexes on databases and collections

When searching for (sub)profiles it's important you set the correct indexes on the fields you are searching for. If the index isn't set, the search can take minutes. While searching in correctly indexed databases/collections will only take a fraction of a second. So make sure all the fields you include in the search have an index on them.

Example clients

We've updated the SOAP API example clients to incorporate these changes.