Question
Yakov Berger · Dec 13, 2020

How to Parse TCP Inbound XML

Hi

I have a medical device (Nipro Surdial Dialysis ) which sends XML messages by TCP.

I would like to insert some of the info into a SQL SERVER table.

Is there some sort of TCP Inbound Adapter for XML ? 

 

Thanks

 

 

Product version: IRIS 2019.1
00
1 0 3 129
Log in or sign up to continue

Replies

There is an EnsLib.XML.TCPService which extends EnsLib.TCP.PassthroughService but the only new thing it does it adds processing for XML SearchTableClass. There is also EnsLib.TCP.CountedXMLInboundAdapter (which inherits from Ens.Util.XML.Reader)

You can try to extend EnsLib.TCP.PassthroughService by overriding its OnProcessInput method and bind it to EnsLib.TCP.CountedXMLInboundAdapter (you may want to explore it further to see whether there are any useful methods there that might help you extract your XML).

In any case, a Business Service simply reads messages from input (File, TCP,  HTTP etc..) into an object. So, you also could send this object to a Business Process which will be processing your XML (it would likely need to extend %XML.Adaptor).

When you talk about writing data into SQL Server do you mean simply storing data into a Cache table? Or do you actually need to write to a real SQL Server? In the latter case, you would need a Business Operation that would bind perhaps to EnsLib.SQL.OutboundAdapter and will call your external database with the data extracted from your XML.

Hi

What's CountedXML ? does it mean that the length is known?

Hi Yakov,

I had not worked with these adapters. Looked at the EnsLib.TCP.CountedXMLInboundAdapter; its (brief) description states that it is an adapter for an XTE server. Nonetheless, it does appear to read counted blocks from TCP socket from the Stream and write into XML-aware object. I would try it with your custom Business Service.