Recently, we were tasked to update our client's BizTalk 2013 and web API applications to support multiple service accounts. One of the main steps is to enhance the code to store multiple service account key value pairs.
We can easily store the key value pairs for web API application by using built in function of .NET web.config.
However, it's more complex to achieve the same goal in a BizTalk application. In this blog, we'll walk you through the steps to store multiple key value pairs in SSO as well as how to retrieve them.
1 - Create a BizTalk schema to house data for <DemoService.APIAccessKeys/> node
2 - Store the entire <DemoService.APIAccessKeys/> node in SSO setting as string
3 - Read SSO setting and convert it into BizTalk message
- Read xml string from SSO and store it in strAPIAcessKey variable
strAPIAcessKey =SSOSettingsFileManager.SSOSettingsFileReader.ReadString("BizTalk.DemoService", "DemoAPIAccessKey");
- Convert xml string into xml document
- Load xml document into BizTalk message
msgAPIAccessKey.parameter = xmlAPIAccessKey