0

I am working on a PowerShell script making use of the Microsoft.BizTalk.ExplorerOM to dynamically update the SB-Messaging SAS key for BizTalk Receive Locations and Send Ports. This is to enable us to roll the SAS keys for our Service Bus queues, and update BizTalk with the new keys as painlessly as possible.

I have this working correctly for Receive Locations, but Send Ports are giving me a different issue.

As soon as I read the PrimaryTransport properties of the Send Port, it seems that some change is made under the covers, that then prevents SaveChanges from working, instead throwing an "Invalid or malformed XML data exception".

Send Port SaveChanges exception

This is compared to the the ReceiveLocation, where I can read any of its properties, and then SaveChanges successfully.

Receive Location successful SaveChanges

Note that in both of this cases, no changes have been made by me. I am simply doing a Read, and then a Save.

Can anyone offer any advice as to what could be causing the issue, and any possible solutions to try?

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
EdL
  • 1

2 Answers2

0

Had this very same issue, when using Powershell to replace values in ServiceBus ReceiveLocations & SendPorts.

The problem is with the none valid xml symbols in the TransportTypeData, which are converted when the script reads them out in the PS cmd.

All none valid xml symbols (such as the one occuring for Namespace value, ) need to be converted to amp, and if I'm not mistaken even double amp:ed.

Here's an example article showing examples on what I mean by "double amp:ed": How do I escape ampersands in XML so they are rendered as entities in HTML?

Hope this make sense, and if not, then let me know and I'll give it another go.

Christian J.
  • 96
  • 2
  • 8
  • See now that I jumped to conclusions, based on my own experience when replacing values in TransportTypeData. No I don't know why it would end in error, when your simply typing out the current properties (and not actually attempting to replace as I first thought). When the error occur, could you again type out the current properties for the SendPort, to see if they somehow changed in between? – Christian J. Sep 27 '17 at 20:15
  • I don't really have the option to type out the properties before and after. This issue is occurring the very first time that I read the properties. Something else that might be worth mentioning, is that this issue is only occurring with Send Ports that are using the SB-Messaging adapter. I can quite happily read and then call Save if I am working against say a FILE adapter Send Port. – EdL Sep 27 '17 at 21:22
  • Reproduce the error on the SendPort, then read the properties again, to see if they remain the same as the SendPort screenshot. – Christian J. Sep 28 '17 at 14:46
0

Just tried doing this from C#, seems to work ok:

        var root = new Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer() { ConnectionString = "Data Source=(local);Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;" };
        var sendPort = root.SendPorts["xxxx.ServiceBusQueue"];
        System.Diagnostics.Trace.TraceInformation(sendPort.PrimaryTransport.TransportTypeData);
        sendPort .PrimaryTransport.TransportTypeData = sendPort.PrimaryTransport.TransportTypeData.Replace("RootManageSharedAccessKey", "MySharedAccessKey");
        root.SaveChanges();
charlie.mott
  • 321
  • 2
  • 8