Send a tcp request to a identification document scanner
I have to communicate with an ID document scanner to get the data that will be read by it. I have to send a request with certain parameters and receive the data through an xml file.
The parameters to send are the ones below
I have an example in C # and, according to the debug I did, it seems to me that the instructions for the request are these:
System.Threading.Thread workingThread = new Thread(ScanWork);
I still can not figure out how I get the answer but I'll try to figure it out.
In the meantime I ask for your help once more.
The method "Scanwork" is below (the parameters.TCP are TCP)
/// Method is processing request based on parameters.
/// <param name="o">Parameters from the input form.</param>
public static void ScanWork(object o)
//Thread can only have object as parameter so we need to cast it to our class
if (!(o is ASInterfaceIntegration.DataManipulation.Parameters)) return;
ASInterfaceIntegration.DataManipulation.Parameters parameters = o as ASInterfaceIntegration.DataManipulation.Parameters;
if (parameters.TCP) // TCP request sent
DoWork.ScanTCP(parameters.RequestXml, parameters.Hostname, parameters.Port, parameters.AdditionalPort);
else // HTTP request sent
if (parameters.EnableJson) // JSON
// callback can contain any value
DoWork.ScanHTTP("callback=Test", parameters.TargetURL, parameters.Action, true);
else // XML
DoWork.ScanHTTP(parameters.RequestXml, parameters.TargetURL, parameters.Action, false);
My question is how do I do it?
The C # code I have is from a demo application that the vendor the scanner has sent me. The demonstration is great because it also includes the screens of parameterization, selection, etc.
With the debug I made I "got" the instructions that are used to make the request but, as it refers, it is difficult to catch all the methods. The idea of rewriting in cobol is because I have to integrate this process into an application.
In terms of the manual I do not have much information either. I have only the request data and the information layout to receive.
I'll try to see the vendor if I get a simpler program that has just the part that matters.
While I have no response from the vendor attached attachment the program in C # which, I believe, has the main part of the code needed.
The required parameters are:
- RequestXml - XML file that I send attached too
- Hostname - "127.0.0.1"
- Port - "56702"
- AdditionalPort - "0"
The other programs are to "build" the xml that is sent in the request and to set the necessary parameters.
I do not know if I can do something with what I send.
I believe that it is not easy to translate that because, as he says, there are many lines and options. Still, there are priority issues.
Anyway, I'm checking to see if the supplier sends me what I asked for.
If you happen to be able to look at the situation, thank you.
I received from the supplier this comment on what needs to be done.
I do not know if it simplifies the question.
1º - Open the TCP port locally on the computer (127.0.0.1)
2º - Send the request to port 56702 (file request_default.xml atached)
3º - Door is always open
4º - The scanner work and create the response xml file
5º - The XML result is returned in the same channel that is still open - file response_default.xml
6º - To finish, after sending the XML, the channel is closed
I received from the vendor a smaller source and only with the instructions that need to be used.
I believe that with this simpler source it will be possible to analyze and "convert" to Cobol.
Attach the zip with the source (BasicTCP.zip).
I also attached a zip.file with the scanner emulator (FakeReader.zip). It is an application that is installed and to which the program will fetch the data.
I am waiting for your help again.