Friday, November 22, 2013

Duplicate Subscription in SSRS

If anyone experience duplicate subscription creation in SSRS while using SOAP API,Don't be panicked. It would be very difficult to troubleshoot this issue.There is a bug in SSRS. It might have caused the issue.

Subscriptions can be created using CreateSubscription() SOAP API . This API creates Subscription and returns SubscriptionId. If you want to update the Subscription, SetSubscriptinProperties() API is used. If you pass SubscriptionID and updated Subscription data, It will update specified Subscription.

If you create Subscription using CreateSubscription() SOAP API and  update the Subscription using the returned SubscriptionId, Intead of updating existing subscription, New Subscription will be created. You will end up in duplicate subscription.

The reason is that CreateSubscription() method returns SubscriptionId with alphabets in lower case. But Original Subscription in SSRS was created with Upper cased SubscriptionId. When You pass the lower cased  Subscription ID to update the existing Subscription, SSRS internally checks with out ignoring case. Since It doesn't find any subscription, It just Create a new one. Even though the MSDN document doesn't say anything about Subscription creation, new subscription is created. Since this API method returns null, You cannot get the SubscriptionID also!.

So always convert the SubscriptionId to upper case and then  pass this converted SubscriptionId to call SetSubscriptionProperties() method.