Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Return http error messages for authentication and server errorrs. Ticket [ea054d339d] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | client-http-error |
Files: | files | file ages | folders |
SHA1: |
027ddd8c7c8d8cb34b56e44bb2767ce0 |
User & Date: | oehhar 2015-06-02 14:07:22 |
Context
2015-06-02 17:30 | Addition case that server did not send any data and just closed check-in: 90dc8d7789 user: oehhar tags: client-http-error | |
2015-06-02 14:07 | Return http error messages for authentication and server errorrs. Ticket [ea054d339d] check-in: 027ddd8c7c user: oehhar tags: client-http-error | |
2015-06-02 13:08 | Dead code removed - is covered by upper if check-in: b63a8eb960 user: oehhar tags: client-http-error | |
Changes
Changes to ClientSide.tcl.
︙ | ︙ | |||
918 919 920 921 922 923 924 925 926 927 928 929 930 931 | https { if {[llength $headers]} { set token [::WS::Utils::geturl_followRedirects $url -headers [string map {\{ \" \} \"} $headers]] } else { set token [::WS::Utils::geturl_followRedirects $url] } ::http::wait $token set wsdlInfo [ParseWsdl [::http::data $token] -headers [string map {\{ \" \} \"} $headers] -serviceAlias $serviceAlias] ::http::cleanup $token } default { return \ -code error \ -errorcode [list WS CLIENT UNKURLTYP $url] \ | > > > > > > > > > > | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | https { if {[llength $headers]} { set token [::WS::Utils::geturl_followRedirects $url -headers [string map {\{ \" \} \"} $headers]] } else { set token [::WS::Utils::geturl_followRedirects $url] } ::http::wait $token if {![string equal [::http::status $token] ok] || [::http::ncode $token] != 200} { set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set errorInfo [FormatHTTPError $token] ::http::cleanup $token return \ -code error \ -errorcode $errorCode \ $errorInfo } set wsdlInfo [ParseWsdl [::http::data $token] -headers [string map {\{ \" \} \"} $headers] -serviceAlias $serviceAlias] ::http::cleanup $token } default { return \ -code error \ -errorcode [list WS CLIENT UNKURLTYP $url] \ |
︙ | ︙ | |||
1290 1291 1292 1293 1294 1295 1296 | ## set body [::http::data $token] ::log::log info "\nReceived: $body" if {![string equal [::http::status $token] ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set errorInfo {} | < < | < | 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | ## set body [::http::data $token] ::log::log info "\nReceived: $body" if {![string equal [::http::status $token] ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set errorInfo {} set results [FormatHTTPError $token] set hadError 1 } else { set hadError 0 set results [::http::data $token] } ::http::cleanup $token if {$hadError} { |
︙ | ︙ | |||
1439 1440 1441 1442 1443 1444 1445 | ::log::log debug "Reply was $body" set errorCode $::errorCode set errorInfo $::errorInfo } } } elseif {![string equal $httpStatus ok] || [::http::ncode $token] != 200} { ::log::log debug "\tHTTP error [array get $token]" | | | 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 | ::log::log debug "Reply was $body" set errorCode $::errorCode set errorInfo $::errorInfo } } } elseif {![string equal $httpStatus ok] || [::http::ncode $token] != 200} { ::log::log debug "\tHTTP error [array get $token]" set results [FormatHTTPError $token] set errorCode [list WSCLIENT HTTPERROR [::http::code $token]] set errorInfo {} set hadError 1 } else { set body [::http::data $token] ::log::log debug "\tReceived: $body" set outTransform [dict get $serviceInfo outTransform] |
︙ | ︙ | |||
1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | $results } else { ::log::log debug "Leaving ::WS::Client::DoCall with {$results}" return $results } } ########################################################################### # # Public Procedure Header - as this procedure is modified, please be sure # that you update this header block. Thanks. # #>>BEGIN PUBLIC<< | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 | $results } else { ::log::log debug "Leaving ::WS::Client::DoCall with {$results}" return $results } } ########################################################################### # # Public Procedure Header - as this procedure is modified, please be sure # that you update this header block. Thanks. # #>>BEGIN PUBLIC<< # # Procedure Name : ::WS::Client::FormatHTTPError # # Description : Format error after a http::geturl failure. # A failure consists wether in the HTTP return code unequal to 200 # or in the status equal "error". Status "timeout" is untreated, as this # http feature is not used in the package. # # Arguments : # tolken - tolken of the http::geturl request # # Returns : # Error message # # Side-Effects : None # # Pre-requisite Conditions : HTTP failure must be present # # Original Author : Harald Oehlmann # #>>END PUBLIC<< # # Maintenance History - as this file is modified, please be sure that you # update this segment of the file header block by # adding a complete entry at the bottom of the list. # # Version Date Programmer Comments / Changes / Reasons # ------- ---------- ---------- ------------------------------------------- # 1 06/02/2015 H.Oehlmann Initial version # # ########################################################################### proc ::WS::Client::FormatHTTPError {token} { if {[string equal [::http::status $token] ok]} { return "HTTP failure code [::http::ncode $token]" } else { return "HTTP error: [::http::error $token]" } } ########################################################################### # # Public Procedure Header - as this procedure is modified, please be sure # that you update this header block. Thanks. # #>>BEGIN PUBLIC<< |
︙ | ︙ | |||
1812 1813 1814 1815 1816 1817 1818 | ## set body [::http::data $token] ::log::log info "\nReceived: $body" if {![string equal [::http::status $token] ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set hadError 1 | | | 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 | ## set body [::http::data $token] ::log::log info "\nReceived: $body" if {![string equal [::http::status $token] ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set hadError 1 set errorInfo [FormatHTTPError $token] } else { SaveAndSetOptions $serviceName if {[catch {set hadError [catch {parseResults $serviceName $operationName $body} results]} err]} { RestoreSavedOptions $serviceName return -code error -errorcode $::errorCode -errorinfo $::errorInfo $err } else { RestoreSavedOptions $serviceName |
︙ | ︙ | |||
3162 3163 3164 3165 3166 3167 3168 | ## Check for errors ## set body [::http::data $token] if {![string equal [::http::status $token] ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set errorInfo {} | | | 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 | ## Check for errors ## set body [::http::data $token] if {![string equal [::http::status $token] ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set errorInfo {} set results [FormatHTTPError $token] set hadError 1 } else { set hadError 0 set results [::http::data $token] } ::http::cleanup $token if {$hadError} { |
︙ | ︙ | |||
3290 3291 3292 3293 3294 3295 3296 | ::log::log info "\tReceived: $body" set httpStatus [::http::status $token] set hadError 0 set results {} if {![string equal $httpStatus ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { ::log::log debug "\tHTTP error [array get $token]" | | | 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 | ::log::log info "\tReceived: $body" set httpStatus [::http::status $token] set hadError 0 set results {} if {![string equal $httpStatus ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { ::log::log debug "\tHTTP error [array get $token]" set results [FormatHTTPError $token] set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set errorInfo {} set hadError 1 } else { SaveAndSetOptions $serviceName if {[catch {set hadError [catch {parseRestResults $serviceName $objectName $operationName $body} results]} err]} { RestoreSavedOptions $serviceName |
︙ | ︙ | |||
3697 3698 3699 3700 3701 3702 3703 | ## set body [::http::data $token] ::log::log info "\nReceived: $body" if {![string equal [::http::status $token] ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set hadError 1 | | | 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 | ## set body [::http::data $token] ::log::log info "\nReceived: $body" if {![string equal [::http::status $token] ok] || ([::http::ncode $token] != 200 && [string equal $body {}])} { set errorCode [list WS CLIENT HTTPERROR [::http::code $token]] set hadError 1 set errorInfo [FormatHTTPError $token] } else { SaveAndSetOptions $serviceName if {[catch {set hadError [catch {parseRestResults $serviceName $objectName $operationName $body} results]} err]} { RestoreSavedOptions $serviceName return -code error -errorcode $::errorCode -errorinfo $::errorInfo $err } else { RestoreSavedOptions $serviceName |
︙ | ︙ |