(Migrated) [Rafed Ramzi] ASK::Failed To send http request to zato

(This message has been automatically imported from the retired mailing list)

Okay, so her eis the details,

request URL: http://101.50.3.41:11223/test

Request Data:

{“Test”:“Test”}

Request Headers:

POST /test HTTP/1.1
Host: 101.50.3.41:11223
Accept: /
Content-Type: application/json
Content-Length: 1229
Expect: 100-continue

Response Header:
HTTP/1.1 100 Continue

Response Body:

Internal Server Error

Internal Server Error

The Test Service Code:

from anyjson import dumps
from zato.server.service import Service
import requests

class Test(Service):
def handle(self):
try:
r = requests.get(“http://protodinas.asia/test.php”)
self.response.payload = dumps®
except requests.ConnectionError as oops:
self.response.payload = dumps(oops.message)

Server 1 Log: https://www.dropbox.com/s/4zx8fscb2n43ebx/server1log.log?dl=0

Server 2 Log: https://www.dropbox.com/s/hvpls2qwiuhbg6z/server2log.log?dl=0

but the weird thing is request works fine from Advanced Rest Client

Thank you for your help,

On Thu, Feb 5, 2015 at 3:05 PM, Dariusz Suchojad dsuch@zato.io wrote:

On 05/02/15 09:02, Rafed Ramzi wrote:

is this the zato problem or the sender problem?

Hi,

unfortunately, it’s impossible to answer the question right now.

In such situations, please always provide:

  • Exact requests you send
  • Exact addresses you send them to
  • Exact responses you receive
  • Exact parts from server.log files at that time
  • Exact code of services receiving the requests

thanks,


Dariusz Suchojad

https://zato.io
ESB, SOA, REST, APIs and cloud integrations in Python

Here it is in server1log.log file:

File “/opt/zato/2.0.0/zato-server/src/zato/server/base/parallel.py”,
line 191, in on_wsgi_request
’user_agent’: wsgi_environ[‘HTTP_USER_AGENT’],
KeyError: u’HTTP_USER_AGENT’

The application you are using doesn’t send the User-Agent HTTP header.

I’ve never heard of any such application before but yes, it turns out
that User-Agent is optional …

https://tools.ietf.org/html/rfc2616#section-14.43

… whereas Zato assumes it will be always provided.

What next:

  • When using http://requestmaker.com/ please add the User-Agent header
    with any value, even ‘123’ will do.

  • Zato will be updated so it doesn’t assume User-Agent is always
    available. The change will be released in 2.0.2 (we are at 2.0.1 now)