I have a program that uses HTTPPOST to upload an XML data file to a REST web service using the form-data content type.
This was working OK but now on some systems it has started to report a NULL response and I cannot determine why.
The equivalent web page upload works OK via Chrome and does not give any errors so dismissing Op sys, machine configuration etc.
I run the post with the code shown below
Any ideas as to why I get a null response on some machines and not others?
01 post-address pic x(150).
78 Content-Type value 'multipart/form-data; boundary="12345"'.
01 request-payload usage pointer.
01 response-payload usage pointer.
01 response-len pic s9(8).
01 request-len pic s9(8).
01 response-status pic 9(3) value zero.
01 import-xml-request pic x(180).
01 parser-handle usage handle.
01 xml-content pic x(99999999).
01 form-data pic x(99999999).
linkage section.
01 response-data pic x(5555).
initialize request-payload request-len.
set request-payload to address of form-data.
call "NetInit" giving response-status.
CALL "NetSSLVerifyPeer" USING SSL-verifypeer-flag
GIVING response-status.
call "HttpSetResponseHeader" using 0
GIVING response-status.
call "C$XML" using CXML-WRITE-STRING
PARSER-HANDLE
xml-content.
call "C$XML" using CXML-PARSE-FILE
import-xml-request.
move return-code to parser-handle
string "--12345"
H"0D0A"
'Content-Disposition: form-data; name="uid"'
H"0D0A"
H"0D0A"
"USERNAME"
H"0D0A"
"--12345"
H"0D0A"
'Content-Disposition: form-data; name="pwd"'
H"0D0A"
H"0D0A"
"PASSWORD"
H"0D0A"
"--12345"
H"0D0A"
"Content-Disposition: form-data; name="
""""
"uploadfile"
""""
"; filename="
""""
UPLOADFILENAME
""""
H"0D0A"
* "Content-Type: text/xml"
"Content-Type: multipart/form-data"
H"0D0A"
H"0D0A"
xml-content
H"0D0A"
"--12345--"
delimited by "$" into form-data.
call "HttpPost" using
Post-Address
Content-Type
request-payload
request-len
response-payload
response-len
giving response-status.
set address of response-data to response-payload.