Bad Gateway 502 error HTTP Response

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Bad Gateway 502 error HTTP Response

Post by René Houba »

Hi,

On the iSeries I start a LANSA function that is doing a:
SERVICE_LOAD SERVICE(HTTPOutboundXMLBindService)
and finally a:
SEND URI(/cgi-bin/jsmdirect.exe?IMAIIDCHKIN01) WAIT(*YES) HOST(10.10.20.60:8080)

This jsmdirect.exe activates on a Windows Composer 7 server a HTTP Configuration that activates a processing sequence.
This processing sequence receives the xml from the iSeries on the Composer Windows server without any problem.

In the Composer Prosessing sequence I use a HTTP_SIMPLE_INBOUND to receive the xml (http content).
BadGateway502(1).png
BadGateway502(1).png (119.84 KiB) Viewed 8817 times
In between the HTTP_SIMPLE_INBOUND Iterator, I activate a user defined activity that receives the content and create an xml response file.
The RESPONSEFILEPATH Inbound parameter is filled with c:\temp\ResponseList.xml (the xml response).

The HTTP RESPONSE is created and filled on the Composer Windows server:
BadGateway502(2).png
BadGateway502(2).png (41.97 KiB) Viewed 8817 times
BadGateway502(3).png
BadGateway502(3).png (44.96 KiB) Viewed 8817 times
So far so good......

The problem I have is that the response xml is not received back on the iSeries.
I get on the iSeries a Bad Gateway 502 error:

Connect directly to host using http : 10.10.20.60:8080
read timeout: 0
connection timeout: 0
Host lookup time : 0 ms
Using IPv4 address 10.10.20.60
Connect to host time : 4 ms
Send and receive buffer sizes : 8192, 8192
Send request time : 1 ms
Receive response status time : 2 sec 948 ms
Receive response status line : HTTP/1.1 502 Bad Gateway
Read response protocol time : 0 ms
Read response content time : 0 ms
Response status : 502
Response message : Bad Gateway

Create trace file : HTTP_RESPONSE_CONTENT.TXT
Create trace file : HTTP_RESPONSE_PROTOCOL.TXT
Command : ERROR "HTTP response has failed"

See next message to continue......
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: Bad Gateway 502 error HTTP Response

Post by René Houba »

The Integrator trace on the iSeries shows:
BadGateway502(4).png
BadGateway502(4).png (147.45 KiB) Viewed 8816 times
I have iSeries trace files available.

And see that the received HTTP_RESPONSE_CONTENT is empty:
BadGateway502(6).png
BadGateway502(6).png (10.38 KiB) Viewed 8816 times
And the HTTP_RESPONSE protocol shows the Bad Gateway 502:
BadGateway502(7).png
BadGateway502(7).png (23.81 KiB) Viewed 8816 times
Does anyone have an idea what the problem is here?
How to solve this?
BrendanB
Posts: 134
Joined: Tue Nov 24, 2015 10:29 am

Re: Bad Gateway 502 error HTTP Response

Post by BrendanB »

Rene,

I had a similar issue just recently, and for me it turned out that the firewall between the 400 and the external webservice was blocking the incoming traffic, so the request went out, was received by the external webservice (in your case, by composer), but then the network blocked any response back to the 400 and reported 502....

Given that the 'Bad Gateway' message is coming from an IIS Server, this suggests 3 possibilities:

1. your organisation has an IIS 'Proxy' which you are using to access Composer, and this is blocking the traffic to the 400.
or
2. the PC that Composer is residing on has firewall turned on and is blocking traffic TO the 400.
or
3. the PC that Composer is on cannot 'see' the 400 (possibly due to DNS issues? - perhaps DNS was changed but the cache has not been refreshed on the PC).

to Test that the PC with Composer can 'see' the 400 -- perhaps try setting up a simple FTP connection and using the TEST button...

Since you have the Trace files on Composer -- can we see the SERVICE.TXT from Composer? there may be a clue in there as to what is happening.

Brendan.
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: Bad Gateway 502 error HTTP Response

Post by René Houba »

Hi Brendan,

Thanks for your reply. Much appreciated...

Relate to your 3 suggestions:
Point 2: The firewall on the Composer Windows machine is not active at all.
Point 3: I created a test FTP configuration to the iSeries and the test gave a good result. So FTP from the Composer Windows to their iSeries is possible.

Here the SERVICE.TXT from the Windows Composer Windows machine:
******************************************************************************************************************************
=================== TRACE OPEN ===================
manager: version : 14.2.0
manager: date : 2020-11-18 16:28:11 +0100

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : SERVICE_LOAD SERVICE_CONTENT(*HTTP) ARCHIVE(E:\LANSA\LANSA Composer Server\DATA\HTTPIn\HI2263.dat) SERVICE(HTTPSERVICE) TRACE(*YES) TRACE_NAME(RN=2397 AT=HTTP_SIMPLE_INBOUND SV=HTTPSERVICE)
Create trace file : HTTP_KEYWORDS.TXT
Create trace file : HTTP_CONTENT.XML
Received content type : application/xml; charset=utf-8
Inbound model : *STRING
Inbound reader : *READER
Inbound result : *UTF8
Parser validation : true
Schema validation : false
Use inbound charset : utf-8
Use inbound encoding : UTF-8
Received content type : application/xml; charset=utf-8
Archive content (UTF-8) : E:\LANSA\LANSA Composer Server\DATA\HTTPIn\HI2263.dat
XML declaration encoding not modified, encoding match
Context is inbound
Command : OK "Service successfully loaded"
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : GET TRUNCATE(*LIST) PROPERTY(*LIST)
Get HTTP property : SERVER-PROTOCOL : HTTP/1.1
Get HTTP property : X-USER-AGENT-LOCALE : nl_NL
Get HTTP property : QUERY-STRING : IMAIIDCHKIN01
Get HTTP property : REMOTE-USER :
Get HTTP property : SERVER-NAME : 10.10.20.60
Get HTTP property : SERVER-PORT : 8080
Get HTTP property : CONTENT-TYPE : application/xml; charset=utf-8
Get HTTP property : REQUEST-METHOD : POST
Get HTTP property : USER-AGENT : LANSA-UserAgent/14.2.0 (Server)
Get HTTP property : CONTENT-LENGTH : 270
Get HTTP property : REMOTE-ADDRESS : 10.10.20.21
Get HTTP property : SERVER-SOFTWARE : Microsoft-IIS/10.0
Get HTTP property : X-DIRECT-VERSION : 14.2.6
Get HTTP property : HOST : 10.10.20.60:8080
Command : OK ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*TEXT)
Received content type : application/xml; charset=utf-8
Check for content : *TEXT
Using content type : application/xml; charset=utf-8
Command : OK ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*SV)
Received content type : application/xml; charset=utf-8
Check for content : *SV
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*XML)
Received content type : application/xml; charset=utf-8
Check for content : *XML
Using content type : application/xml; charset=utf-8
Command : OK ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*CSV)
Received content type : application/xml; charset=utf-8
Check for content : *CSV
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*TSV)
Received content type : application/xml; charset=utf-8
Check for content : *TSV
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*EDI)
Received content type : application/xml; charset=utf-8
Check for content : *EDI
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*X12)
Received content type : application/xml; charset=utf-8
Check for content : *X12
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*EDIFACT)
Received content type : application/xml; charset=utf-8
Check for content : *EDIFACT
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*EXCEL)
Received content type : application/xml; charset=utf-8
Check for content : *EXCEL
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*PDF)
Received content type : application/xml; charset=utf-8
Check for content : *PDF
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*IMAGE)
Received content type : application/xml; charset=utf-8
Check for content : *IMAGE
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*GIF)
Received content type : application/xml; charset=utf-8
Check for content : *GIF
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*JPEG)
Received content type : application/xml; charset=utf-8
Check for content : *JPEG
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*FORM)
Received content type : application/xml; charset=utf-8
Check for content : *FORM
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : IS CONTENT(*MULTIPART)
Received content type : application/xml; charset=utf-8
Check for content : *MULTIPART
Using content type : application/xml; charset=utf-8
Command : NO ""
--------------------------------------------------

--------------------------------------------------
Process : DXPROC02
Function : *COMP
Partition : LIC
Job Name : JOB003204
Job User : ADMLANSA
Job Number : 003204
Command : SEND HANDLER(InboundFile) FILE(c:\temp\ResponseList.xml) CONTENT(*TEXTXML)
Send content handler : com.lansa.jsm.service.InboundFileHandler
Using outbound content handler type 2
InboundFileHandler send method has been invoked
Send file content
Create HTTP inbound response from byte array
Use outbound encoding : UTF-8
Output mode : not available
Using protocol encoding : ISO8859_1
Append charset : utf-8
Create trace file : HTTP_RESPONSE_CONTENT.XML
Server software : Microsoft-IIS/10.0
Create trace file : HTTP_RESPONSE_PROTOCOL.TXT
Response has been created
Command : OK ""
--------------------------------------------------

=================== TRACE CLOSE ==================

******************************************************************************************************************************

We also see in the HTTP_RESPONSE_PROTOCOL.TXT on Windows (Composer) that we get a Status 200:
BadGateway502(8).png
BadGateway502(8).png (49.37 KiB) Viewed 8775 times
So it seems to me that the send on the Windows composer machine went ok....
Strange this is that we see here on the Windows Composer machine Status 200, but on the iSeries we see the error 502 Bad Gateway???
Post Reply