Setting Up Web Service Integration Follow

0
Avatar
Legacy Poster

Through trial and error I have gotten integration builder to respond and print when a web request is sent to a specific port and integration on the machine it is installed on.

 

You can see it in action here...

http://screencast.com/t/lhEEn7P1

 

You can see that integration builder is listening for requests on port 10101 (in this case), and responds by printing a document when I go to that URL with my local web browser.  This is about the simplest situation in the world, because all it does it print out a static label when I go to that url (http://192.168.1.26:10101/Integration/robtest/Execute) which is my local machine where bartender is running.

 

My question now is, how do I pass actual variables when I post to this URL and then use them in the Actions section to be able to dynamically control the printing?  I would prefer JSON format post or XML, but I still need to know how it needs to be formatted.

 

The "Input Data" section of integation builder has a drop down with JSON and XML as two of the options.  How does integration take what I pass in the URL post and use it?

 

 Documentation please!

9 comments

0
Avatar
Legacy Poster
Comment actions Permalink

In addition, the help files say this...

 

Database Overrides

 



  • Data Source: Specifies the data source, if any, to use
    when printing the document.



    • Use Document Setting: Specifies that the data source
      specified in the document will be used.


    • None: Specifies that no data source will be used.


    • Integration Input Data: Specifies that the data source
      to be used is the integration's input data.


    • Text File: Specifies that a text file will be used for
      the data source.


    • SAP IDoc File: Specifies that a SAP IDoc file will be
      used for the data source.


    • Location: Specifies the file system where the data
      source file exists. File systems or locations can include local file systems or
      network shares, Librarian, FTP, WebDAV (HTTP), and Dropbox. Available if
      either
      Text File or SAP IDoc File are selected as the Data Source.

 

But it goes into no further explanation of details in how to tie into the "Integration Input Data" .   It seems like that is what I want.  But I cannot figure out the details a programmer needs to implement it.  The online help always seems to go right up to the point of getting to the "meat" of things, and then stops.  Is there other documentation that gets into the technical aspects of implementing this.

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Yes, our technical writers are busy working on additional documentation in the form of white papers, and no doubt BarTender 2016 R2 will add more expansive detail to the Help system on these topics.  Please bear with us in the meantime.

 

Find attached a quick document I've put together for handling GET requests with parameter values used to set the document and printer to use, and to set data directly on the label.

0
Avatar
Legacy Poster
Comment actions Permalink

This is great!  Thank you.  We got it working based on the document you posted above.

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Did you get that working with POSTed JSON data, or did you go another route?  I'd be interested to learn what you went with in order to complete the solution.  Cheers!

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Update on how to use JSON data.

 

If we assume the below JSON data is being POSTed to your web service on the Integrations Platform:

 

{
"CompanyName": "Seagull Scientific",
"Address": "Madrid, Spain",
"PostCode": "28001"
}
 
Make sure the "Input Data" for your integrations is set to "JSON Variables".
 
This would create in the integration at time of the event the following Variables that can then be used in your integration actions.  There is no need to create custom variables in a predefined way:
 
%CompanyName%
%Address%
%PostCode%
 
*Note that these variables are case sensitive.
 
If you wanted to transform this data into a CSV, which BarTender could then deal with as a record set, then add a Set Variables action, give it a name like JSONdata, and then a value like below:
 
"CompanyName","Address","Postcode"
"%CompanyName%","%Address%","%PostCode%"
 
I hope that helps.
0
Avatar
Legacy Poster
Comment actions Permalink

Can the host name of url not localhost?

When I start advanced rest client on machine B and make GET request A's ip>/Integration/getlabel/Execute?ctnno=00001 (Integration Builder is hosted in machine A), the rest client returns connection timeout.

 

 

Is the call blocked by firewall?  

What can the cause be?

 

Thanks,

 

Connie

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

connie107: Yes of course the URL can be on a different PC, not just the localhost, as otherwise that would be a not very useful feature.  I guess it could be firewall problems.  I suggest you get in contact with tech-support and do a fault diagnosis. 

0
Avatar
Mark Janos
Comment actions Permalink

Hi Support,

Is there any way to specify a "RecordSet" directly in JSON?

If I use BTXML I can specify a RecordSet inline with the XML using CDATA, but is there a way to do this using a JSON request body?

My goal is to specify an arbitrary number of "Named Data Sources" (label parameters) without having to manually map these to label parameters. 

The reason for this is that I can specify both the name of the label and the printer using a JSON element, but because I have hundreds of label designs, I don't want to manually map all the label parameters to elements in the JSON document.

Thanks for your help,

Mark J

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

Mark: Alas, there is no CDATA equivalent value type in JSON.  However, as alluded to in the below StackOverflow article, you could cheat by having the record set data be crammed into a single JSON variable value, and then have the Integration Platform make use of it as record data on the server side.  Perhaps you'd need to do some transforms on the integration variable that contains the record data should you have encoded the data, or used a special placeholder character for the record separator.  Once done, you can then use that transformed integration variable as being the source of your record set in a BarTender Print Document action.

https://stackoverflow.com/questions/14935866/json-is-there-any-xml-cdata-equivalent 

Please sign in to leave a comment.