Can someone help me with this problem?

Client A needs to sync data with an external system X (e.g. we need to sync a user's properties).

To do this Client A calls Webservice B which in its turn calls an external system X like this:
Cleint A -> WebService B -> Exernal System X

I am responsible for the implementation of the webservice B, which is a SOAP JAX-WS webservice that does very simple things:
1. logs an incoming request in the DB(using SOAP Handler)
2. calls another SOAP JAX-WS webservice to update data in the external system X
3. logs an outgoing response in the DB (Using SOAP Handler)

Now imagine that there is an exception at step 3, e.g., if the database audit table is locked for update by another process. As a result the error will be sent to the client A, but at step 2 data is already successfully changed in the external system X.

So the data has been successfully updated in System X but Client A got an error and the transaction was not completed for client A. The result is the data is inconsistent between Client A and System X.

Is there any solution to this problem?

Thank you