1

I am trying to call Marketing Cloud SOAP API from APEX with the following Request Body:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <fueloauth>accessToken</fueloauth>
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>DataExtensionObject[Map_Edm_To_Email]</ObjectType>
            <Properties>Edm</Properties>
            <Properties>SubscriberKey</Properties>
            <Properties>EventDate</Properties>
            <Properties>Email</Properties>
            <Filter xsi:type="SimpleFilterPart">
               <Properties>Email</Properties>
               <SimpleOperator>equals</SimpleOperator>
               <Value>abc@abc.com</Value>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

I can confirm I set up oauth correctly and am pointing to correct DE (Otherwise I get "DE not found" error.)

I set the above as my request body, with the following headers:

Http h = new Http();
    HttpRequest r = new HttpRequest();
    r.setTimeout(60000);
    r.setEndpoint('https://webservice.exacttarget.com/Service.asmx');  
    r.setMethod('POST');
    r.setHeader('SOAPAction','Retrieve'); 
    r.setHeader('Content-type','text/xml');    
    r.setBody(soapBody);    
    HttpResponse s = h.send(r);
    system.debug(s.toString());
    return s.getBody();

And the following is the response body:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 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" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Header>
      <wsa:Action>RetrieveResponse</wsa:Action>
      <wsa:MessageID>deleted</wsa:MessageID>
      <wsa:RelatesTo>deleted</wsa:RelatesTo>
      <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
      <wsse:Security>
         <wsu:Timestamp wsu:Id="Timestamp-deleted">
            <wsu:Created>2018-08-22T05:18:45Z</wsu:Created>
            <wsu:Expires>2018-08-22T05:23:45Z</wsu:Expires>
         </wsu:Timestamp>
      </wsse:Security>
   </soap:Header>
   <soap:Body>
      <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <OverallStatus>Error: Value cannot be null.Parameter name: key</OverallStatus>
         <RequestID>deleted</RequestID>
      </RetrieveResponseMsg>
   </soap:Body>
</soap:Envelope>

The error is <OverallStatus>Error: Value cannot be null.Parameter name: key</OverallStatus>

I don't have a parameter named "key". What am I missing here?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.