I am building a custom Integration between Sales Cloud and Marketing Cloud using the LogUnsubEvent call to unsubscribe a subscriber and get the metrics updated correctly on the reports providing the JobId. Parent Business unit with many childs.
I have build the request successfully, but when starting to test it (From salesforce itself and Postman) I noticed that the Subscriber is not being unsubscribed at all, even thought I get a Success response from the server and I am providing the required information in the request.
Response :
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
<wsa:Action>UpdateResponse</wsa:Action>
<wsa:MessageID>urn:uuid:999f67c1-e516-450f-bc3e-e7ed2d7ce21f</wsa:MessageID>
<wsa:RelatesTo>urn:uuid:be477f48-2c0c-404f-b6e5-c3a99252d56b</wsa:RelatesTo>
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
<wsse:Security>
<wsu:Timestamp wsu:Id="Timestamp-2f21aa1b-b881-43cc-9c55-54aa175b9fa5">
<wsu:Created>2019-12-10T15:34:33Z</wsu:Created>
<wsu:Expires>2019-12-10T15:39:33Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soap:Header>
<soap:Body>
<UpdateResponse xmlns="http://exacttarget.com/wsdl/partnerAPI">
<RequestID---REQUEST ID----</RequestID>
<OverallStatus>OK</OverallStatus>
</UpdateResponse>
</soap:Body>
</soap:Envelope>
I have been through the documentation and through other posts to see if I am missing something, but I after going through my code and request over and over again, I am not able to see what is missing.
Request:
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<UsernameToken>
<Username>----Username----</Username>
<Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">---Password----</Password>
</UsernameToken>
</Security>
</Header>
<Body>
<ExecuteRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Requests>
<Name>LogUnsubEvent</Name>
<Client>
<ID>12345678</ID>
</Client>
<Parameters>
<Name>SubscriberKey</Name>
<Value>[email protected]</Value>
</Parameters>
<Parameters>
<Name>JobID</Name>
<Value>11111</Value>
</Parameters>
</Requests>
</ExecuteRequestMsg>
</Body>
</Envelope>
Just in case you want to check my header parameters too:
private static String makeHTTPXMLPost(String endPoint, String soapBody){
Http h = new Http();
HttpRequest r = new HttpRequest();
r.setTimeout(60000);
r.setEndpoint(endPoint);
r.setMethod('POST');
r.setHeader('Accept','text/xml');
r.setHeader('Content-type','text/xml');
r.setHeader('charset','UTF-8');
r.setHeader('SOAPAction', 'Update');
r.setClientId('ID' , '100014439');
r.setBody(soapBody);
HttpResponse s = h.send(r);
System.debug('response' + s.getBody());
return s.getBody();
}