Question
· Feb 25

Getting a response on an httpRequest from objectscript client to Python Server

I am sending an httpRequest from ObjectScript to a python server.   I am not receiving a response in OS
 
OS config On the client side

// Create an HTTP request object
    Set httpRequest = ##class(%Net.HttpRequest).%New()
    
    // Set the server URL
    Set httpRequest.Server = "http://127.0.0.1:8080"
    
    // Set content type to JSON
    Set httpRequest.ContentType = "application/json"

    // Clear any existing entity body"{""name"": ""Lowell Buschert"", ""dob"": ""1970-12-09"", ""address"": ""XXXXX""}"
    do httpRequest.EntityBody.Clear()
    //Set httpRequest.EntityBody = "{""name"": ""Lowell Buschert"", ""dob"": ""1970-12-09"", ""address"": ""XXXXX""}"

    Set httpRequest.ContentType = "application/json"  // Set the content type to JSON
 
    Set status = httpRequest.Post("/collect_patient_information")

On the server side

When I enter the Server IP into the browser, an form pops up 
I enter some data on the form       
Enter Patient Information
Name:
lowell buschert

Date of Birth:
1970-12-09

Address:
xxx

SUBMIT

The input is formatted with value pairs into a JSON structure

{""name"": ""Lowell Buschert"", ""dob"": ""1970-12-09"", ""address"": ""xxx""}"
and click on submit 

127.0.0.1 - - [25/Feb/2024 04:21:34] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [25/Feb/2024 04:21:35] "GET /favicon.ico HTTP/1.1" 404 -
Formatted Patient Data: {'name': 'lowell buschert', 'dob': '1970-12-09', 'address': 'xxx'}
127.0.0.1 - - [25/Feb/2024 04:21:45] "POST /collect_patient_information HTTP/1.1" 200 -

In OS ,  I displayed some information 
httpRequest: http://127.0.0.1:8080 application/json 2@%Library.GlobalBinaryStream  

status: 0 /«http://127.0.0.1:8080:80 HSFNDý!e^zOpen+59^%Net.HttpRequest.1^2!e^zSend+30^%Net.HttpRequest.1^1 e^zPost+1^%Net.HttpRequest.1^1%e^zCollectInfo+19^OBHG.AIR.Main.1^1'e^zGetPatientInfo+2^OBHG.AIR.Main.1^1 e^zOnStart+3^OBHG.AIR.Main.1^1&d^zDebugStub+40^%Debugger.System.1^1 d^^^0 

statusline:  reasonPhrase: StatusReasonPhrase: HTTP request failed with status code: Response: 

Product version: IRIS 2023.1
Discussion (5)2
Log in or sign up to continue

I set  

Set httpRequest.Server = "127.0.0.1
 Set httpRequest.Port = "8080 

Request from OS          Set status = httpRequest.Post("/collect_patient_information")

from the server side log   

Response  127.0.0.1 - - [25/Feb/2024 10:44:58] "POST /collect_patient_information HTTP/1.1" 200 -
 

Status on ObjectScript on Response. 

httpRequest: 127.0.0.1 application/json 2@%Library.GlobalBinaryStream status: 0 %«127.0.0.1:8080HSFNDý!e^zOpen+59^%Net.HttpRequest.1^2!e^zSend+30^%Net.HttpRequest.1^1 e^zPost+1^%Net.HttpRequest.1^1%e^zCollectInfo+20^OBHG.AIR.Main.1^1'e^zGetPatientInfo+2^OBHG.AIR.Main.1^1 e^zOnStart+3^OBHG.AIR.Main.1^1&d^zDebugStub+40^%Debugger.System.1^1d^^^0 statusline: reasonPhrase: StatusReasonPhrase: HTTP request failed with status code: Response:
 

Something is getting lost between Server  Python and client OS