[SalesForce] Cannot get SOAP API to retrieve Data Extension Fields

Am hoping that someone can help me out, I have looked on some previous threads but just seem to be missing something.

I am trying to make the below SOAP call:

GET: https://webservice.s6.exacttarget.com/Service.asmx

Headers:

Content-Type: text/xml; charset=utf-8

Body:

<?xml version="1.0" encoding="utf-8"?>

<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>
  <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
     <wsse:UsernameToken wsu:Id="UsernameToken-24440876" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsse:Username>USERNAME</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</wsse:Password>
     </wsse:UsernameToken>
  </wsse:Security>
</soapenv:Header>
<soapenv:Body>
  <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
     <RetrieveRequest>
        <ObjectType>DataExtensionObject[ED91E930-1FBA-4C19-93F2-78B74842F60D]</ObjectType>
        <Properties>CampaignName</Properties>
        <Properties>Description</Properties>
        <Properties>CommunicationType</Properties>
        <Filter xsi:type="SimpleFilterPart">
           <Property>CampaignName</Property>
           <SimpleOperator>equals</SimpleOperator>
           <Value>Touch Base with Client</Value>
        </Filter>
     </RetrieveRequest>
   </RetrieveRequestMsg>
 </soapenv:Body>

Response:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Error</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1" />
    <meta name="CODE_LANGUAGE" content="C#" />
    <meta name="vs_defaultClientScript" content="JavaScript" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
</head>
<body style="margin: 0px; padding: 0px; font-family: Arial;">
    <table style="height:100%; width:100%;" border="0" cellpadding="5" cellspacing="0">
        <tr style="height:10%; background-color:#808080">
            <td>
                <div style="color:#ffffff; font-size: 16px;">An error has occurred and has been logged by our system.
                    <br />
                    Thank you. </div>
            </td>
        </tr>
        <tr valign="top">
            <td>
                <div id="errorTxt">&nbsp;</div>
            </td>
        </tr>
    </table>
</body>
</html>

Thanks,
Garth

Best Answer

  1. It should be HTTPPOST not HTTPGET, you also need to have these two in headers:

    Content-Type:text/xml; charset=utf-8

    SOAPAction:"Retrieve"

2.The Body Content looks wrong for retrieving DataExtensionField objects. It should look something like below:

 <soapenv:Body><RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
 <RetrieveRequest>
    <ObjectType>DataExtensionField</ObjectType>
    <Properties>Name</Properties>
    <Properties>FieldType</Properties>
    <Filter xsi:type="SimpleFilterPart">
       <Property>DataExtension.CustomerKey</Property>
       <SimpleOperator>equals</SimpleOperator>
       <Value>ED91E930-1FBA-4C19-93F2-78B74842F60D</Value>
    </Filter>
 </RetrieveRequest></RetrieveRequestMsg></soapenv:Body>

Check this link for more properties you can retrieve for DataExtensionField Object

Related Topic