Skip to main content
Question

Https request suddenly stopped working.

  • July 27, 2026
  • 8 replies
  • 44 views

Gary Rhodes
Forum|alt.badge.img+1

The code below suddenly stopped working. I perform the same request with a curl statement and it works.  does someone see something I should change or add to my request or is universe 11.xx not up to date with modern security?

 

051:       HTTP.METHOD    = "POST"
052:       OUT.URL        = TOKEN.URL:TOKEN.ENDPOINT
053:       VERSION.CODE   = setHTTPDefault('VERSION','1.1')
054:       CTX.TYPE       = ''
055:       MY.RTN.CODE    = createSecurityContext(MY.CONTEXT, CTX.TYPE)
056:       CREATE.CODE    = createSecureRequest(OUT.URL,HTTP.METHOD,HANDLE,MY.CO
NTEXT)
057:       RET1 = setRequestHeader(HANDLE,'Accept','*/*')
058:       RET1 = setRequestHeader(HANDLE,"content-type","application/x-www-form
-urlencoded")
059:       RET1 = setRequestHeader(HANDLE,'HTTP Protocol','HTTP/1.1')
060:       REQUEST.OUT  = 'grant_type=password'
061:       REQUEST.OUT:= '&username=':USERNAME
062:       REQUEST.OUT:= "&password=":USERPW
063: *
064:       stat           = submitRequest(HANDLE,30000,REQUEST.OUT,RESPONSE.HEAD
ERS,RESPONSE.DATA,HTTP.STATUS)

8 replies

Chris Charles
Forum|alt.badge.img

Hi Gary,

Check to see what the value of your MY.RTN.CODE variable is after your call createSecurityContext().

I’m guessing there’s going to be an error.

Your CTX.TYPE variable is blank. Try setting it to TLSv1.2 as the protocol version.


Gary Rhodes
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • July 27, 2026

When CTX.TYPE is blank the type defaults so no error there. I did try TLSv1.2 but that did not work as well. I appreciate your suggestions. Thanks,


Chris Charles
Forum|alt.badge.img

Can you show me your curl command?

You can X out the private info


Gary Rhodes
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • July 27, 2026

This is what I execute that works. I would prefer not doing this. Makes me think I may need to create a subroutine that I will eventually use more and more out of necessity.

 

069: *      STMT = 'curl -v \':CHAR(10)
070: *      STMT:= '-X POST "https://domainname.com/auth/token" \':CHAR(10)
071: *      STMT:= '-H "Accept:*/*" \':CHAR(10)
072: *      STMT:= '-d "':REQUEST.OUT:'"'
073: *      STMTS = "sh -c '":STMT:"'"
074: *      EXECUTE STMTS CAPTURING STUFF


Gary Rhodes
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • July 27, 2026

i added the data here.

069: *      STMT = 'curl -v \':CHAR(10)
070: *      STMT:= '-X POST "https://domainname.com/auth/token" \':CHAR(10)
071: *      STMT:= '-H "Accept:*/*" \':CHAR(10)
072: *      STMT:= '-d "grant_type=password&username=XXXXX&password=XXXXX"’
073: *      STMTS = "sh -c '":STMT:"'"
074: *      EXECUTE STMTS CAPTURING STUFF


Chris Charles
Forum|alt.badge.img

The most evident difference I see is your curl command doesn’t include the content-type header.

But I do see you said “stopped working” which indicates it worked in the past.

Are you getting errors from any of the function calls?


John Jenkins
Forum|alt.badge.img+1
  • Participating Frequently
  • July 27, 2026

I recommend turning on logging on the call and see what the log file procides as a diagnostic trace. It;s usually easy to decipher. 


Gary Rhodes
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • July 27, 2026

i removed this line and it works. I didn’t think that wouild be the fix.

RET1 = setRequestHeader(HANDLE,'HTTP Protocol','HTTP/1.1')

 

Thanks for the suggestions. It got me to try different things that I did not think would be the cure. this is what is working now

.052:       HTTP.METHOD    = "POST"
053:       OUT.URL        = TOKEN.URL:TOKEN.ENDPOINT
054:       VERSION.CODE   = setHTTPDefault('VERSION','1.1')
055:       CTX.TYPE = ''
056:       MY.RTN.CODE    = createSecurityContext(MY.CONTEXT, CTX.TYPE)
057:       CREATE.CODE    = createSecureRequest(OUT.URL,HTTP.METHOD,HANDLE,MY.CO
NTEXT)
058:       RET1 = setRequestHeader(HANDLE,'Accept','*/*')
059:       RET1 = setRequestHeader(HANDLE,"content-type","application/x-www-form
-urlencoded")
060:       REQUEST.OUT  = 'grant_type=password'
061:       REQUEST.OUT:= '&username=':USERNAME
062:       REQUEST.OUT:= "&password=":USERPW
063: *
064:       stat           = submitRequest(HANDLE,30000,REQUEST.OUT,RESPONSE.HEAD
ERS,RESPONSE.DATA,HTTP.STATUS)