Tuesday 22 December 2015

SilverPop Integration ASP.net with C# and XML

      This article focuses on how to integrate SilverPop Engage 4 in .NET.

      SilverPop is a third party emailing tool which is not only provide the facility to prepare the email templates which needs to be used in sending an email as well as it provides the support for campaign management through various things.

     By using SilverPop Engage we can send an email on scheduling basis like hourly,daily,weekly,monthly etc.

    SilverPop Transact provides the facility to send an email for some triggerring mechanism like user registered successfully,etc.

For integrating the SilverPop we need to add this URL : http://api4.silverpop.com/SoapApi?wsdl

Silver pop XML Login
Before calling any other interface we need to get authenticated first by using Login interface. If Silverpop successfully authenticated the request with the provided credentials then it will return SUCCESS=true and SESSIONID which will be used for making call to Silverpop's interface(s).
            public  string SilverpopXMLLogin(string userName, string password)
            {
                  string loginSessionid = "";

                  string xmlData = "";
                  xmlData = (xmlData + " <Envelope>");
                  xmlData = (xmlData + "<Body>");
                  xmlData = (xmlData + "<Login>");
                  xmlData = (xmlData + "<USERNAME>" + userName + "</USERNAME>");
                  xmlData = (xmlData + "<PASSWORD>" + password + "</PASSWORD>");
                  xmlData = (xmlData + "</Login>");
                  xmlData = (xmlData + "</Body>");
                  xmlData = (xmlData + "</Envelope>");
                  string resonseFromAPI = SivlerpopXMLAPIRequest(xmlData);
                  string result = resonseFromAPI;
                  string html = result;
                  string[] values = html.Split(new string[] { "<Envelope>", "<Body>", "<RESULT>", "<SUCCESS>", "<SESSIONID>", "<ORGANIZATION_ID>", "<SESSION_ENCODING>", "</RESULT>", "</Body>", "</Envelope>", "</SUCCESS>", "</SESSIONID>", "</ORGANIZATION_ID>", "</SESSION_ENCODING>", "true", "\n", "\t" }, StringSplitOptions.RemoveEmptyEntries);
                  List<string> list = new List<string>(values);
                  loginSessionid = list[0].ToString();
                  return loginSessionid;

            }


No comments:

Post a Comment