X3270.Rest

X3270.Rest is a wrapper for the standard x3270 HTTP REST interface. Remote controlling the x3270 client via HTTP is very advantageous because the HTTP protocol is very mature and as popular as never before. This imlies a broad support of any kind. In terms of .NET this means that one can easily build really asynchronous calls from ones application to the x3270 terminal by using just a few native features for HTTP. This is why I built X3270.Rest that wrapps all the calls to x3270 for you in a straighforward manner.

To find out more have a look at

the X3270.Rest wiki pages or
the X3270.Rest test project

One thought on “X3270.Rest

  1. From: Paul Mattes [mailto:paul.mattes@usa.net]
    Sent: Monday, June 26, 2017 9:45 AM
    To: Arturo Galindo (ARXG)
    Subject: Re: Help! Unable to use x3270 with httpd option

    Found it!
    It was not at all what I expected it would be. It turns out that x3270’s web server could not process an HTTP field with a one-character-long value, and since I originally wrote the code, browsers have begun sending the field “Upgrade-Insecure-Requests: 1” with their GET operations.
    I plan to post a fix this morning, and I will let you know when it is available.
    I really appreciate the bug report.

    On 6/26/2017 9:22 AM, Arturo Galindo wrote:
    Thanks Paul for your help. I will be waiting for your response.

    From: Paul Mattes [mailto:paul.mattes@usa.net]
    Sent: Saturday, June 24, 2017 8:30 PM
    To: Arturo Galindo (ARXG)
    Subject: Re: Help! Unable to use x3270 with httpd option

    I don’t have access to my test system right now, but I should have time to take a look at this tomorrow.

    pdm

    On Jun 24, 2017, at 6:30 PM, Arturo Galindo wrote:
    Hi Paul,

    My name is Arturo. I am trying to use your x3270 emulator with the httpd option but I am getting an error (Protocol error) in the view tracer.

    I start the x3270 terminal with the following line and I get the green screen from host indicating a connection is established:
    wc3270 -trace -model 3278-2 -httpd 6001 +S -utf8

    I then go to the browser and type:
    http://localhost:6001/3270/rest/

    The result is a 400 response. The host view tracer receives the request but displays a protocol error (see view tracer response below). I trace the error back to the httpd-io.c of the x3270 terminal code, but I have not been able to identify the root of the problem and I am lost at this point.

    Also, I get the same response if I create a .Net API client in c# using Steve England x32709 REST Wrapper
    https://github.com/stevenengland/X3270/wiki/X3270-REST

    I would really appreciate any input or recommendation you can provide on how to best troubleshoot this problem.

    Thanks!

    Environment details
    Windows 7 Enterprise
    Service Pack 1
    Chrome Browser

    x3270 Terminal Status:
    wc3270 v3.5ga10 Mon Jan 16 17:54:41 CST 2017 pdm
    Model 3278-2-E: 80 columns x 24 rows, monochrome, extended data stream
    Terminal name: IBM-3278-2-E
    LU name: IA00344B
    EBCDIC character set: bracket (SBCS)
    Host code page: 37+
    Host SBCS CGCSGID: GCSGID 697, CPGID 37
    Windows code page: OEM 437 ANSI 1252
    Connected to: XXXXXXX
    Port: 23
    TN3270E SSCP-LU mode, 19 minutes 39 seconds
    TN3270E options: BIND-IMAGE RESPONSES SYSREQ

    View Tracer from host connection

    20170624.181842.163 h [0] Response: 400 Bad Request
    20170624.181842.163 h> [0] 0x0000 48 54 54 50 2f 31 2e 31 20 34 30 30 20 42 61 64 HTTP/1.1 400 Bad
    20170624.181842.163 h> [0] 0x0010 20 52 65 71 75 65 73 74 0d 0a 44 61 74 65 3a 20 Request..Date:
    20170624.181842.163 h> [0] 0x0020 53 61 74 20 4a 75 6e 20 32 34 20 32 33 3a 31 38 Sat Jun 24 23:18
    20170624.181842.163 h> [0] 0x0030 3a 34 32 20 32 30 31 37 20 55 54 43 0d 0a 53 65 :42 2017 UTC..Se
    20170624.181842.164 h> [0] 0x0040 72 76 65 72 3a 20 77 63 33 32 37 30 20 76 33 2e rver: wc3270 v3.
    20170624.181842.164 h> [0] 0x0050 35 67 61 31 30 20 4d 6f 6e 20 4a 61 6e 20 31 36 5ga10 Mon Jan 16
    20170624.181842.164 h> [0] 0x0060 20 31 37 3a 35 34 3a 34 31 20 43 53 54 20 32 30 17:54:41 CST 20
    20170624.181842.164 h> [0] 0x0070 31 37 20 70 64 6d 0d 0a 43 6f 6e 6e 65 63 74 69 17 pdm..Connecti
    20170624.181842.165 h> [0] 0x0080 6f 6e 3a 20 63 6c 6f 73 65 0d 0a 43 6f 6e 74 65 on: close..Conte
    20170624.181842.165 h> [0] 0x0090 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74 nt-Type: text/ht
    20170624.181842.165 h> [0] 0x00a0 6d 6c 3b 20 63 68 61 72 73 65 74 3d 69 73 6f 38 ml; charset=iso8
    20170624.181842.165 h> [0] 0x00b0 38 35 39 2d 31 0d 0a 859-1..
    20170624.181842.165 h> [0] 0x00b7 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 Content-Length:
    20170624.181842.166 h> [0] 0x00c7 33 32 38 0d 0a 0d 0a 328….
    20170624.181842.166 h> [0] 0x00ce 3c 21 44 4f 43 54 59 50 45 20 48 54 4d 4c 20 50 [0] 0x00de 55 42 4c 49 43 20 22 2d 2f 2f 49 45 54 46 2f 2f UBLIC “-//IETF//
    20170624.181842.166 h> [0] 0x00ee 44 54 44 20 48 54 4d 4c 20 32 2e 30 2f 2f 45 4e DTD HTML 2.0//EN
    20170624.181842.167 h> [0] 0x00fe 22 3e 0d 0a 3c 68 74 6d 6c 3e 0d 0a 20 3c 68 65 “>…. [0] 0x010e 61 64 3e 0d 0a 20 20 3c 74 69 74 6c 65 3e 34 30 ad>.. 40
    20170624.181842.167 h> [0] 0x011e 30 20 42 61 64 20 52 65 71 75 65 73 74 3c 2f 74 0 Bad Request [0] 0x012e 69 74 6c 65 3e 0d 0a 20 3c 2f 68 65 61 64 3e 0d itle>.. .
    20170624.181842.167 h> [0] 0x013e 0a 20 3c 62 6f 64 79 3e 0d 0a 20 3c 68 31 3e 34 . .. 4
    20170624.181842.168 h> [0] 0x014e 30 30 20 42 61 64 20 52 65 71 75 65 73 74 3c 2f 00 Bad Request [0] 0x015e 68 31 3e 0d 0a 4d 61 6c 66 6f 72 6d 65 64 20 66 h1>..Malformed f
    20170624.181842.168 h> [0] 0x016e 69 65 6c 64 20 28 6d 69 73 73 69 6e 67 20 76 61 ield (missing va
    20170624.181842.168 h> [0] 0x017e 6c 75 65 29 20 69 6e 20 72 65 71 75 65 73 74 2e lue) in request.
    20170624.181842.169 h> [0] 0x018e 0d 0a 20 3c 68 72 3e 0d 0a 20 3c 69 3e 77 63 33 .. .. wc3
    20170624.181842.169 h> [0] 0x019e 32 37 30 20 76 33 2e 35 67 61 31 30 20 4d 6f 6e 270 v3.5ga10 Mon
    20170624.181842.169 h> [0] 0x01ae 20 4a 61 6e 20 31 36 20 31 37 3a 35 34 3a 34 31 Jan 16 17:54:41
    20170624.181842.169 h> [0] 0x01be 20 43 53 54 20 32 30 31 37 20 70 64 6d 20 2d 20 CST 2017 pdm –
    20170624.181842.170 h> [0] 0x01ce 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f [0] 0x01de 78 33 32 37 30 2e 62 67 70 2e 6e 75 2f 22 3e 78 x3270.bgp.nu/”>x
    20170624.181842.170 h> [0] 0x01ee 33 32 37 30 2e 62 67 70 2e 6e 75 3c 2f 61 3e 3c 3270.bgp.nu
    [0] 0x01fe 2f 69 3e 0d 0a 20 3c 2f 62 6f 64 79 3e 0d 0a 3c /i>.. .. [0] 0x020e 2f 68 74 6d 6c 3e 0d 0a /html>..
    20170624.181842.171 h> [0] Close: protocol error
    20170624.181842.171 Waiting for events
    20170624.181842.172 Got event 0x102
    20170624.181842.173 Waiting for events
    20170624.181842.407 Got event 0x3

Leave a Reply

Your email address will not be published. Required fields are marked *