HTTP Outgoing Connection: URL Problem with ADFS full address

On Postman, this works:
api/v2/accounts/username/xxyy%5C0001
(i.e. the API takes in the ADFS full address as the parameter)

However, the following equivalent Zato code fails.

user = “xxyy” + “\” + "0001"
var = {}
var[‘username’] = user
response = out1.conn.send(self.cid, params=var)
(The parameter “username” is set in SIO as required output.)

Zato Exception message:
File “/opt/zato/2.0.7/code/zato-server/src/zato/server/service/init.py”, line 429, in update_handle
raise resp_e
ZatoException: Expected elem:[username] not found in item:[{u’username’: u’’}]

Response from the API:
{u’message’: u’Unknown location: …’}, status_code: 404

Regards,
Wesley

Hello @Wesley,

I’m not sure what ADFS is but is the status_code 404 not returned by the remote API because in Postman you use e0004819 but with Zato this is e0012235?

Hi Dariusz,

Many thanks for the response. I am sorry that I did not update that I have solved the problem.

The problem is with URL encoding in Python and Zato due to the presence of backslash character in the URL. The URL string needs to pass through urllib.quote first. Then the URL is valid to the destination web service.

userstr = “xxyy” + “\” + “0001”
user = urllib.quote(userstr)
var = {}
var[‘username’] = user
response = out1.conn.send(self.cid, params=var)

I see, thanks for the update @Wesley!