perl - Malformed Session ID Cookie -


set-cookie: sessionid=836cfc64b5856712b040a0b1b3bf4237; secure; httponly set-cookie: watson-dpat=gbjqjag%2fyflxphkcwjvswqpebuumikj38zzfm8uzntboerxbexs4wvxbit5jetjbkeo1rt16pnz6%2bi17ofreqvxjny%2fifzrorvbxxvzdmfkrpfrlxxj6znvfcvurl1dtfw3nl8ne1qdwpukqmnt8%2bd9vfk7bgjlaziht0zfhnffwjt7frcwbujayjkd%2bqui2wtil6b8kglpi6gg1buh5upde%2bc8ovrqyafjrfyoaprdx7khhthdxiv7g%2fznexxhafscqxi4cwea5kg9ygcypr8sio%2fd7woq0kyerhudkbzath53ccii25it5xd0plnt3cvc4bws8txkmt82v9dwcyulto64l%2bgnh30itpyv72xoifheztt2kisfhxmy6z86ueajzznd4ns6rwc7s2e8ldxwylxrcu996xslmzpybgszaeflplg7c%2bcxztlall5fn8emmbgn30w%2brxlntcaj3lrk2nvzqcim1ghmdqoovocsvpwijovbrf8lc75egsr8c%2fovq20fok3ndw4f0upfbegzyuatxjonu7qdrhsglrxxkygvcyhewewuoq2kvti2m%2frd%2bmrx9384p1v6uu8xfau16iqoidv0vew3mlpw4fxcowrqnwky0iiybijrwvcigloiy%2fnxgo7ohw7aacgh1u8iluaurz5aie1bej4l%2fjai91iutessbg6fsxd3aqmlkixdgldjbgtetmoxhxvydjvjsavuqdftokp3ycrnhltzqdq3vg8txtlzecsyqhz7dgwp%2b98p3zjvtad9xb%2bdzxhf4caub7ve99bwo5fo1du3krhx7peakgseldcoxtokjihemmjbeqrbc1qwj4ur9klbpbdibshd3; path=/speech-to-text/api; secure; httponly 

the request create speech text session works.

{    "recognize": "https://stream.watsonplatform.net/speech-to-text/api/v1/sessions/836cfc64b5856712b040a0b1b3bf4237/recognize",    "recognizews": "wss://stream.watsonplatform.net/speech-to-text/api/v1/sessions/836cfc64b5856712b040a0b1b3bf4237/recognize",    "observe_result": "https://stream.watsonplatform.net/speech-to-text/api/v1/sessions/836cfc64b5856712b040a0b1b3bf4237/observe_result",    "session_id": "836cfc64b5856712b040a0b1b3bf4237",    "new_session_uri": "https://stream.watsonplatform.net/speech-to-text/api/v1/sessions/836cfc64b5856712b040a0b1b3bf4237" } 

then try status of session make sure state "initialized" "malformed session id cookie" error.

get /speech-to-text/api/v1/sessions/836cfc64b5856712b040a0b1b3bf4237/recognize http/1.1\x0d content-length: 0\x0d accept-encoding: gzip\x0d authorization: basic ogiymtk0mdytywyzys00ytfhlwexymmtzda3zjnlnty2y2jmom1lympbag1ndkhmsw==\x0d cookie: sessionid=836cfc64b5856712b040a0b1b3bf4237; watson-dpat=gbjqjag%2fyflxphkcwjvswqpebuumikj38zzfm8uzntboerxbexs4wvxbit5jetjbkeo1rt16pnz6%2bi17ofreqvxjny%2fifzrorvbxxvzdmfkrpfrlxxj6znvfcvurl1dtfw3nl8ne1qdwpukqmnt8%2bd9vfk7bgjlaziht0zfhnffwjt7frcwbujayjkd%2bqui2wtil6b8kglpi6gg1buh5upde%2bc8ovrqyafjrfyoaprdx7khhthdxiv7g%2fznexxhafscqxi4cwea5kg9ygcypr8sio%2fd7woq0kyerhudkbzath53ccii25it5xd0plnt3cvc4bws8txkmt82v9dwcyulto64l%2bgnh30itpyv72xoifheztt2kisfhxmy6z86ueajzznd4ns6rwc7s2e8ldxwylxrcu996xslmzpybgszaeflplg7c%2bcxztlall5fn8emmbgn30w%2brxlntcaj3lrk2nvzqcim1ghmdqoovocsvpwijovbrf8lc75egsr8c%2fovq20fok3ndw4f0upfbegzyuatxjonu7qdrhsglrxxkygvcyhewewuoq2kvti2m%2frd%2bmrx9384p1v6uu8xfau16iqoidv0vew3mlpw4fxcowrqnwky0iiybijrwvcigloiy%2fnxgo7ohw7aacgh1u8iluaurz5aie1bej4l%2fjai91iutessbg6fsxd3aqmlkixdgldjbgtetmoxhxvydjvjsavuqdftokp3ycrnhltzqdq3vg8txtlzecsyqhz7dgwp%2b98p3zjvtad9xb%2bdzxhf4caub7ve99bwo5fo1du3krhx7peakgseldcoxtokjihemmjbeqrbc1qwj4ur9klbpbdibshd3\x0d user-agent: mojolicious (perl)\x0d host: stream.watsonplatform.net\x0d  http/1.1 400 bad request\x0d x-backside-transport: fail fail\x0d connection: keep-alive\x0d transfer-encoding: chunked\x0d x-error-cause: zuul error: malformed session id cookie\x0d content-type: application/json\x0d date: wed, 01 jun 2016 19:41:26 gmt\x0d server: -\x0d x-global-transaction-id: 237895544\x0d x-dp-watson-tran-id: stream-dp01-c0182762-b9fe-4533-acab-7fbeb02b63dd\x0d 

the code using single instance of mojo::useragent cookies maintained on each request.

when using sessions receive sessionid cookie when creating session, cookie need send service on every call make after creating session. please note value of cookie not equal "session_id": "836cfc64b5856712b040a0b1b3bf4237", longer alphanumeric string.

btw. why using sessions? use case? maybe benefit sessionless calls (simpler) or websockets (better live use cases)

dani


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo