1

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();
}

1 Answer 1

0

So good news that is also bad news. It is a very tiny thing, but it is breaking the whole call.

You have the SOAPAction in your header as 'Update' and it should be 'Execute'.

Once you change this, it should work as expected.

A way to check this without looking at the header each time is to look at the response received and make sure the Response type matches the type you sent.

E.g. you sent ExecuteRequest but received UpdateResponse.

3
  • Well that 'Execute' was the source of the breaking after all. Thanks for pointing that out, I was convinced that the issue was on the Request XML.
    – Pbird
    Dec 11, 2019 at 9:27
  • @Pbird, If this solves your issue please be sure to mark the check box next to my answer to allow an easy reference for anyone else facing the same issue. Thanks and glad you figured it out! Dec 11, 2019 at 14:30
  • @Gortonington - a follow up Q here. Once this call is successful, do you expect to see an Unsubscribe recorded under Send >> Tracking for that JOBID?
    – Maneesh
    Oct 13, 2022 at 12:14

You must log in to answer this question.

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