Bartender Web Service Integration

I need to up our barcoding process and am planning to migrate from generating labels from Epicor using SSRS to using Bartender Enterprise. We are all on-premise, but it looks like it would be a lot cleaner to build an Epicor function that uses the Bartender web service integration method, rather than a file drop. Has anyone done this successfully?

1 Like

Just throwing @Chris_Conn under the :bus:

Kinetic Warehouse - SSRS Tag Printing? - Kinetic 2021 - Epicor User Help Forum (epiusers.help)

1 Like

@Mark_Wonsil perfect timing eh?

@danvoss The short answer is yes. You coming to Insights this year?

1 Like

Thought I had read all the pertinent threads, but missed that one.

@Chris_Conn - Yes, I will be at Insights, Sunday - Thursday.

Excellent, definitely check out the EpiUsers panels. I think they are on Wednesday. There should be 3 with all different content, not sure which one I am in at this point but I will be discussing this exact thing for my presentation.

It’s only a 15-20m time block so dont expect in depth coverage, but it will be a great getting-started on how\why and what to look out for.

I expect I will make a more in-depth demo\write up sometime soon, probably I will put it on my LinkedIn. If I have it done by the time of Insights I will share the link with the attendees.

If you plan to get started before then, my first tip is make sure you use POST style so you have full flexibility over the data you send to the webservice. And as always, I am available ad-hoc hourly for projects\assistance.

3 Likes

We are using Bartender Enterprise in our E10 environment using BarTender Integrations that were migrated from the old Commander model. This is still basically the same technique that Epicor implemented with their Bartender implementation.

In E10, we abandoned their canned label reports and created C# routines that create the drop files from a PartTran Data Directive. When the appropriate TranType is created, the BPM determines what label to generate based on the TranType and which printer to use based on the Current User. This technique has worked well and has generated thousands of labels that have 2D barcodes that allow complete records Keys (Job/AssySeq/Seq etc.) to be entered from a single scan.

We are currently working on migrating to Kinetic and intend to go completely browser-based at go-live. In Kinetic, we have created a Function library that can be called from a BPM, a Kinetic App Studio layer, etc. that has basically the same C# code from E10 with a single input parameter (the PartTran TranNum). This also seems to work well in our testing so far.

1 Like

@jhopeross Bold move to jump from 10.1.600 to Kinetic web UI! Good luck! As I understand it, then with your function library you are still using file drop method, correct?

We transact Bartender labels through the web API. The built-in Newtonsoft module makes it dead simple, though I haven’t dabbled with functions much yet. One of these days…

Anyway, my general pattern goes like this:

string uri = "http://bartenderServer/Integration/IntegrationName/Execute";
foreach (var row in yourDatset)
    {
        HttpWebRequest hwr = (HttpWebRequest)WebRequest.Create(uri);
        hwr.Method = "POST";
        using (StreamWriter sw = new StreamWriter(hwr.GetRequestStream()))
        using (JsonTextWriter jtw = new JsonTextWriter(sw))
        {
            jtw.WriteStartObject();
            
            jtw.WritePropertyName("ItemQty");
            jtw.WriteValue(row.ReceivedQty);
            
            jtw.WritePropertyName("LotNum");
            jtw.WriteValue(row.LotNum);
            
            jtw.WritePropertyName("PartDesc");
            jtw.WriteValue(row.PartDescription);
            
            jtw.WritePropertyName("PartNum");
            jtw.WriteValue(row.PartNum);
                
            jtw.WriteEndObject();
        }
        hwr.GetResponse();
    }
}

Bartender doesn’t like receiving multiple labels in one post, so each loop creates a separate request with a single object in each. Make sure you switch the code block to async once you get everything working as intended.

2 Likes

John,

@jtownsend

My one question to you is, how are you handling errors sent back from bartender?

-Utah

I don’t send errors back. If ERP can’t connect to Bartender, it will throw a http connection error by itself. If there’s a problem with the printing, the Bartender log will tell me what’s up…kinda. I struggled for a week and half with an intermittent error that was only resolved by switching to Bartender’s print driver over Zebra’s.

If you’re wondering why I added GetResponse() to the last line…the label wouldn’t fire off without it. :man_shrugging:

Oh, before I forget, you can set up your labels so that the printer name is tied to an input variable. So I pass along a “PrinterName” property and a value and Bartender sends it to the appropriate device. I use the computer name in the Epicor session to do a printer lookup (in a separate code block) and pass the value along in the Bartender post. So you can have one integration print to multiple devices.

I looked at Epicor’s Workstation but didn’t like that it tied them to people. I want workstation X to print to printer A regardless of who’s using it.

I’ve gotta get back to it so I can bail at an appropriate hour, but if you’ve got questions on this admittedly rambling post, ask away.

You’re good man, I spent a week or so just looking at responses to be able to show our user anything instead of the program just sitting there.

That’s my only qualm with their responses.

Yes. We are using Bartender Integrations with files being created by the Function in a folder monitored by Bartender.

1 Like

John @jhopeross ,

I was advised by Manny at bartender to pursue using a web based call instead of a folder drop moving forward.

If you would like to see how it works I can show you the integration and the code in Epicor to make the call.

This is great, I have it working through a Function, and I love this. @jtownsend your code works great. I do want to echo @utaylor 's question about the response.

Since a Function can have an output (or many as the need dictates), I would like to pass on at least if the HTTP request failed for some reason.

I agree, the details are irrelevant (and one problem could be the integration has stopped anyway), but a simple failure notice would be good.

Any thoughts on how to extract that here?

It varies so much Jason, I feel like bartender could do a much better job at providing one response variable that held error messages of the various degrees (i.e. stop, warn, info).

Then you could just check those and know if something is wrong.

Right now they tell you to check a combination of fields and then you have to get the response.

It’s not very straightforward and I don’t feel 100% on it. You literally have to test a bunch of scenarios and then code around the responses you get to really come up with it.

That’s what I did anyways…

I need to convert this to a function because it’s used in so many places…

I will do that as my improvement.

So, you know me, coding is not my gig, but I was hoping for something simple (to a simpleton) like the HTTP response (200, 404, etc.). Not so much the novel that BarTender spits out.

The HttpWebRequest.GetResponse() method call should return a WebResponse object. In my example I just don’t do anything with that. You could pass the return to a variable and run some logic on it.

var response = hwr.GetResponse();
1 Like

That’s what I had to do. That’s what I did.

What you’ll find though if you are using a webservice integration from bartender is that the response variable is either too brief or not structured enough to run quick logic on it. You have to create a response variable with all the fields you wish to read.

1 Like