ExactTarget Marketing Cloud seems to have a comprehensive SOAP API and have SDKs in Java, .NET, PHP and Ruby for that. I am wondering if there is a SDK built for Apex. I don't see it available on the documentation. However, since Salesforce has re-branded ExactTarget as Marketing Cloud, I am hoping that someone from the Salesforce expert team should have built an Apex SDK as well.

Because of the nature of the SOAP API's WSDL, we weren't able to use it using the proxy classes generated using WSDL2Apex (especially because of lack of the SOAP header for setting authentication parameter). So, we tried to build the SOAP message directly and POST it to the end point. Now, we are facing issues with calling the method that adds subscribers to the subscriber list. Any help on this is greatly appreciated.

  • 1
    There isn't an Apex SDK yet. What do you mean by the 'lack of the SOAP header for setting authentication parameter'? Have you referred to this documentation on using an OAuth token in your header? Are you using this method to create a Subscriber? If so, try using the h:fueloauth auth (from my first link) instead of o:Security with basic username/password auth. – Eliot Harper Aug 22 '16 at 10:22
  • Further to my last comment, the correct OAuth header should look like: <h:fueloauth xmlns="http://exacttarget.com" xmlns:h="http://exacttarget.com">insertAccessTokenHere</h:fueloauth> – Eliot Harper Aug 22 '16 at 10:25
  • @EliotHarper I meant that there is no provision in the WSDL2Apex generated class to set this header (because this header is not defined in the WSDL grammar). So, I switched to manually construct the SOAP message instead of using WSDL2Apex class. I used the fueloauth header for setting the access token and was able to retrieve all subscribers from the API. Now I am looking at invoking [this method] (code.exacttarget.com/apis-sdks/soap-api/…). The sample SOAP message provided here doesn't seem to work for me. This is where I am having issues and need h – Suresh Kumar Aug 22 '16 at 14:51

I've never tried to create a Subscriber using the SOAP API, but you're right; the documented method doesn't work, even after fixing the &gt; typos.

Are you able to make a REST request instead? If so, I'd recommend using the Contacts method. Here's what your request should look like:

POST https://www.exacttargetapis.com/contacts/v1/contacts
Authorization Bearer insertAccessTokenHere
Content-Type application/json

           "name":"Email Addresses",
                       "name":"Email Address",
                       "name":"HTML Enabled",

Note that the value of contactKey is used as the Subscriber Key. This method will also create a Contact Record for the subscriber (in Contact Builder).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.