cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

Business Transactions Feed into c# with protobuf

matthew_van_kuy
Inactive

Hi All,

I am trying to implement the Business Transaction Feed on a C# tool. I was able to create the C# class using the protobuf tools provided by google.

I am getting the post request and I am able to get the byteArray containing the data. This is the part where I am stuck: How do I convert the byteArray to an object of the class generated by protobuf.

There are several classes available in the class file, but I am not managing to make it usefull.

Can anybody give me a hint or a tutorial?

Kind regards,

Matt

1 REPLY 1

matthew_van_kuy
Inactive

Apparently protobuf provides it's own parser.

hereby the code snippet I used.

if (Request.ContentLength > 0)
{
buffer = new byte[Request.ContentLength];
using (BinaryReader br = new BinaryReader(Request.InputStream))
br.Read(buffer, 0, buffer.Length);
}

BusinessTransactions bts = BusinessTransactions.Parser.ParseFrom(buffer);