Subscribe/Unsubscribe a recipient to a Service through Soap Call | Adobe Campaign Classic

Subscribe-unsbscribe-techonol-prajwal-shetty

During Adobe Campaign implementation, we do need to perform a certain task only using a simple soap call. Subscribing and unsubscribing a recipient is one such scenario.

This was one such Adobe Classic implementation I was working on.

Pre-requisites:

  • Using SOAP UI tool
  • Basic knowledge of firing a soap call in Adobe Campaign (refer to AC WebService for details)
  • How to download WSDL for any data schema in Adobe Campaign (don’t worry, I have explained it below)

To subscribe/unsubscribe a recipient, we have to use the two methods (subscribe/unsubscribe) that are available in the nmsSubscription WSDL.

To generate a WSDL file, you must enter the following URL from a Web browser:

http://<server>/nl/jsp/schemawsdl.jsp?schema=nms:subscription

With:

  • <server>: the Adobe Campaign application server (your campaign instance url)
  • <schema>: schema identification key (namespace:schema_name)
  • Login with mc or admin credential

You can find high-level information from the below documentation.

https://docs.campaign.adobe.com/doc/AC6.1/en/CFG_API_Business_oriented_APIs.html

Now, that you are all set. Let me provide you with the soap call that will help you in subscribing and unsubscribing a recipient.

Subscribe:

Mention the service name in the <urn:strServiceName> tag and the recipient email who you want to subscribe to the service.

Also, you have to generate a new session token like the one provided in the example has expired.

Rest of the XML remains the same.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:nms:subscription">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:Subscribe>
         <urn:sessiontoken>___4C3F6BB7-7681-45E2-A025-3E46D96264B2</urn:sessiontoken>
         <urn:strServiceName>newsletter</urn:strServiceName>
         <urn:elemRecipient>
             <recipient _key="@email" email= "prajwalshetty202@gmail.com"/>
         </urn:elemRecipient>
         <urn:bCreate>true</urn:bCreate>
      </urn:Subscribe>
   </soapenv:Body>
</soapenv:Envelope>

Unsubscribe:

Similarly, you can use the unsubscribe soap call as well.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:nms:subscription">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:Unsubscribe>
         <urn:sessiontoken>___4C3F6BB7-7681-45E2-A025-3E46D96264B2</urn:sessiontoken>
         <urn:strServiceName>newsletter</urn:strServiceName>
         <urn:elemRecipient>
            <recipient _key="@email" email= "prajwalshetty202@gmail.com"/>
         </urn:elemRecipient>
      </urn:Unsubscribe>
   </soapenv:Body>
</soapenv:Envelope>

You can use this code snippet in your website, mobile app or any application that can fire a soap call.

Bonus Knowledge:

Taking this XML and making a soap call is one thing but it is very important that you understand what are the changes that happen on the database side and on the front end.

If you are interested in understanding that, you can have a look at my next post on Database vs Front-end Analysis | Subscribe/Unsubscribe to a Service through Soap Call

 

error: Content is protected !!