endurox.tpcall

endurox.tpcall(svc: str, idata: object, flags: int = 0) endurox.TpReply

Synchronous service call. In case if service returns TPFAIL or TPEXIT, exception is not thrown, instead first return argument shall be tested for the tperrno for 0 (to check success case).

tpcall example
    # Call service with UBF buffer
    tperrno, tpurcode, retbuf = e.tpcall("EXBENCH", { "data":{"T_STRING_FLD":"Hi Jim"}})
    if e.TPESVCFAIL==tperrno:
        e.tplog_warn("Service failed")
    e.tplog_debug("Service responded %s" % retbuf["data"]["T_STRING_2_FLD"][0])

For more details see tpcall(3).

Raises:

AtmiException

Following error codes may be present:
TPEINVAL - Invalid arguments to function.
TPEOTYPE - Output type not allowed.
TPENOENT - Service not advertised.
TPETIME - Service timeout.
TPESVCFAIL - Service returned TPFAIL or TPEXIT (not thrown).
TPESVCERR - Service failure during processing.
TPESYSTEM - System error.
TPEOS - System error.
TPEBLOCK - Blocking condition found and TPNOBLOCK flag was specified
TPETRAN - Target service is transactional, but failed to start the transaction.
TPEITYPE - Service error during input buffer handling.

Parameters:
Returns:

  • int – tperrno - error code

  • int – tpurcode - code passed to tpreturn(3) by the server

  • dict – ATMI buffer returned from the server.