Error while decoding the request



Znuny and ((OTRS)) Community Edition

OTRS 5 TicketUpdate via WebServices JSON : Error while decoding request content..

Moderator: crythias

OTRS 5 TicketUpdate via WebServices JSON : Error while decoding request content..

Post by LXsysadmin » 25 Mar 2019, 14:51

We are trying to update multiple tickets via OTRS 5 web services using JSON. All is working fine except for one ticket. JSON looks the same as for other tickets.
We get error like:

Message: Decoding the JSON string failed:
RemoteAddress:
RequestURI: /nph-genericinterface.pl/Webservice/Robot/TicketUpdate/106589?SessionID=H3uAMCCcPNIj1Dem7o30PeIk4zBxnK3K
Traceback (32704):
Module: Kernel::System::JSON::Decode Line: 139
Module: Kernel::GenericInterface::Transport::HTTP::REST::ProviderProcessRequest Line: 290
Module: Kernel::GenericInterface::Transport::ProviderProcessRequest Line: 108
Module: Kernel::GenericInterface::Provider::Run Line: 180
Module: ModPerl::ROOT::ModPerl::Registry::opt_otrs_bin_cgi_2dbin_nph_2dgenericinterface_2epl::handler Line: 38
Module: (eval) (v1.99) Line: 204
Module: ModPerl::RegistryCooker::run (v1.99) Line: 204
Module: ModPerl::RegistryCooker::default_handler (v1.99) Line: 170
Module: ModPerl::Registry::handler (v1.99) Line: 31

ERROR: GenericInterfaceProvider-10 Perl: 5.10.1 OS: linux Time: Mon Mar 25 14:32:26 2019
Message: DebugLog error: Summary: Error while decoding request content. Data : No data provided.
Message: DebugLog error: Summary: Request could not be processed Data : Error while decoding request content..
Message: DebugLog error: Summary: Returning provider data to remote system (HTTP Code: 500) Data : Error while decoding request content..

Can we somehow get more information about what is wrong? JSON validators say, that JSON is correct. How to get output what and where something goes wrong? Is there some value incorrect or symbol or.

Re: OTRS 5 TicketUpdate via WebServices JSON : Error while decoding request content..

Post by root » 25 Mar 2019, 15:18

Show your JSON and HTTP method.
Any details in the web service log (switch to debug first)

Znuny and Znuny LTS running on CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system — always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know where it goes ?

Источник

error while decoding bytestream #1223

Comments

Adi-18 commented Jun 6, 2019 •

I geht errors like this while access to stream:

.
[h264 @ 0000000033a298c0] left block unavailable for requested intra4x4 mode -1
[h264 @ 0000000033a298c0] error while decoding MB 0 13, bytestream 234391
[h264 @ 0000000033a2e0c0] left block unavailable for requested intra4x4 mode -1
[h264 @ 0000000033a2e0c0] error while decoding MB 0 32, bytestream 12860
[h264 @ 0000000033a29480] left block unavailable for requested intra4x4 mode -1
[h264 @ 0000000033a29480] error while decoding MB 0 13, bytestream 352876
[h264 @ 0000000033a2e0c0] cabac decode of qscale diff failed at 67 54
[h264 @ 0000000033a2e0c0] error while decoding MB 67 54, bytestream 36823
[h264 @ 0000000033a29480] error while decoding MB 53 32, bytestream -5
[h264 @ 0000000029b3d740] error while decoding MB 57 35, bytestream -5
[h264 @ 0000000033a2e540] error while decoding MB 42 37, bytestream -15
[h264 @ 0000000033c400c0] error while decoding MB 59 34, bytestream -5
.

The image looks not clear. I work with JavaFx8 an Javacv 1.5.0.
Capturing with FrameRate: 25.0, Width: 1920, Height: 1080, Codec; H.264
When I move the ptz-head, the image get worse.

When I open the stream in VLC player or web interface, the image looks perfect.

Desired image:

BTW: Those this library use GPU for rendering?

The text was updated successfully, but these errors were encountered:

Источник

Error while decoding the request

perlCrazy has asked for the wisdom of the Perl Monks concerning the following question:

  • Comment on Getting error while decoding JSON object via POST method
  • Select or Download Code
Replies are listed ‘Best First’.
Re: Getting error while decoding JSON object via POST method
by tobyink (Canon) on Feb 06, 2013 at 06:39 UTC

The error is on these two lines.

If you’d used strict Perl would have told you about the undeclared variable $inputData.

[reply]
[d/l]
[select]
    Re^2: Getting error while decoding JSON object via POST method
    by perlCrazy (Monk) on Feb 06, 2013 at 07:20 UTC
      Sorry for not providing the complete code. updated the code just now. problem is not with variable definition, please check the error:
      malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before «(end of string)»
[reply]
      Re^3: Getting error while decoding JSON object via POST method
      by Corion (Patriarch) on Feb 06, 2013 at 07:25 UTC

        Have you printed out your JSON data string at the receiving end to see what you get there? An empty string gives the same error message:

        I think you are trying to pass the data around in a very bad manner:

        If you send POST data, please read HTTP::Request on how to send POST data. If you want to send the data in an URI, please encode it properly using URI::Encode.

[reply]
[d/l]
        Re^4: Getting error while decoding JSON object via POST method
        by perlCrazy (Monk) on Feb 06, 2013 at 08:40 UTC
          Re^5: Getting error while decoding JSON object via POST method
          by Corion (Patriarch) on Feb 06, 2013 at 09:01 UTC
      Re^3: Getting error while decoding JSON object via POST method
      by tobyink (Canon) on Feb 06, 2013 at 09:59 UTC

      This error message occurs when you pass the empty string or an undefined variable to be decoded by JSON, JSON::PP or JSON::XS.

      So I’d suggest that even with the updated code, the problem is related to the initialization of $jsonText — it appears to be undef.

[reply]
[d/l]
Re: Getting error while decoding JSON object via POST method
by tobyink (Canon) on Feb 06, 2013 at 09:48 UTC

    Here is an example of a CGI script that accepts JSON via HTTP POST, reads two numbers «a» and «b» from the input, and adds them together returning «c», plus an example client that uses the script.

[reply]
[d/l]
[select]
    Re^2: Getting error while decoding JSON object via POST method
    by perlCrazy (Monk) on Feb 06, 2013 at 10:26 UTC
      thanks for response, still getting same error. i tried code : cleint : server side: output of run : ./test_client.pl $VAR1 = < 'error_msg' =>‘Failed during execution: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before «(end of string)») ‘, ‘status_code’ => 500 >; Thanks
[reply]
[d/l]
[select]
      Re^3: Getting error while decoding JSON object via POST method
      by Anonymous Monk on Feb 06, 2013 at 10:35 UTC
        And the reason you don’t DUMP the data is because?
[reply]
        Re^4: Getting error while decoding JSON object via POST method
        by perlCrazy (Monk) on Feb 06, 2013 at 14:19 UTC
        Re^4: Getting error while decoding JSON object via POST method
        by perlCrazy (Monk) on Feb 06, 2013 at 10:53 UTC
    Re^2: Getting error while decoding JSON object via POST method
    by Anonymous Monk on May 19, 2014 at 16:21 UTC
      I’m getting this exact same error when trying to access the body of an application/json POST when the request is HTTP 1.1. If it’s an HTTP 1.0 request, all is fine. HTTP 1.1 requests don’t set the «Content-Length» header and use «Transfer-Encoding» with a value of «chunked». Does anyone know the proper way to grab the JSON payload of a POST request that will work with both HTTP 1.0 and HTTP 1.1?
[reply]
      Re^3: Getting error while decoding JSON object via POST method
      by Corion (Patriarch) on May 19, 2014 at 17:43 UTC

        Implementing a transfer encoding on the server side is not easy. I would try to prevent sending data using the «chunked» transfer encoding. Depending on your client library, there are different ways to prevent that.

[reply]
        Re^4: Getting error while decoding JSON object via POST method
        by boftx (Deacon) on May 19, 2014 at 18:56 UTC
          Re^5: Getting error while decoding JSON object via POST method
          by Corion (Patriarch) on May 19, 2014 at 19:27 UTC
Re: Getting error while decoding JSON object via POST method
by Mr. Muskrat (Canon) on Feb 07, 2013 at 20:00 UTC

my $perlData = $json->decode($response->content());

You don’t want the raw content returned by $response->content(). You want the decoded content as returned by $response->decoded_content(). tobyink had it correct in his reply but he didn’t explicitly call it out and you didn’t pick up on it.

[reply]
[d/l]
[select]
    Re^2: Getting error while decoding JSON object via POST method
    by johndeighan (Novice) on Apr 05, 2017 at 12:33 UTC
      I know that this is an old thread, but I’m having exactly this problem and the answer presented isn’t entirely satisfactory. What I mean is that the problem presented used the CGI module on the server side, but the solution presented (using $request->decoded_content instead of $request->content) applies to the client script, which uses LWP, but not to the server script. I don’t see anything in the CGI module that will do the required decoding. In my case, I’m using Apache and an Apache::Request object, which also does not (from what I can find on the web) chunked data. I have no control over the format of the data arriving at my server. Most of the time my script works, presumably because it’s usually not chunked. I am using Fiddler to debug my script. When I first inspect the response, the POST body appears to have stray characters before and after the actual JSON code. However, Fiddler tells me that I need to decode it, which I do by simply clicking a button, after which the JSON appears correct. This leads me to believe that I’m having exactly the problem described in this thread. If I had an HTTP::Request object, I would just call $req->decoded_content() but the only way that I know to get one is using LWP, which doesn’t make sense on the server side.
[reply]
      Re^3: Getting error while decoding JSON object via POST method
      by Corion (Patriarch) on Apr 05, 2017 at 12:37 UTC

      So, can you show us the code you are using, together with «good» and «bad» input data? Ideally, the code would be about 20 lines.

[reply]
      Re^3: Getting error while decoding JSON object via POST method
      by huck (Prior) on Apr 05, 2017 at 13:27 UTC

      This routine replaces HTML entities found in the $string with the corresponding Unicode character. Unrecognized entities are left alone. Im not sure this would work on «chunks», $orig has to be the entire string to decode at once for with chunks an entity could be split across them.

      Источник

      Accept-Encoding, Content-Encoding, and ERR CONTENT DECODING FAILED

      I wrote a online learning project for Manning Publications called Federation and Single Sign-On with OpenID Connect! This is a great resource for anyone who wants to learn about digital identity, OpenID Connect, and JavaScript development. Read more about the project or buy it now!

      I was testing an application deployed in a new environment recently and was noticing a difference in behavior between the new environment and the old one. HTTP requests from the browser to our API endpoints were showing a status code of 200 (successful) but failed with an error:

      It’s not an error I had seen before but I assumed it was due to something with . content decoding.

      Content encoding is a way to send less data over the network, typically resulting in overall faster page loads. This type of performance improvement is fairly cheap in that it’s typically just a switch or two on your server. Making this change can do everything from improve SEO and increase conversions to making your application more usable over slow connections.

      How it works, in the simplest case is:

      1. Your browser, in this case, makes a request with an Accept-Encoding header (MDN ref) to say what types of encoding your device is capable of decoding. When I request my homepage in Safari, I send the following to say «I can speak br , gzip , and deflate compression algorithms.» Implicitly, the browser can also receive plain text responses as well.
      1. The server receiving this request reads the header, determines the type of compression that it is able to provide, and then compresses (or doesn’t) the response. The response will come with a Content-Encoding header (MDN ref) to tell the browser what, if any, compression was used. That header will be omitted if no compression was used.
      1. The browser uses this header to decompress and interpret the returned HTML, JSON, etc.

      This conversation is called, generally, content negotiation and it can be quite difficult to troubleshoot. The server receives a number of headers, both standard and custom, and then decides what content to send back. I might send a language of es-ES and that I accept a application/json content type and I would expect a JSON response in Spanish (if the server was capable of both of those things).

      There are a number of layers to look at when figuring out what is going wrong:

      • The client, in the form of a browser or API tool like Postman or just direct cURL
      • Any intermediaries or caches like Varnish or Cloudflare
      • The server application itself

      Even if things are properly configured (which they might not be), there are many variables to take into account.

      Do I know exactly what headers I’m sending with my request?
      Do I know exactly what headers I’m getting back?
      Do I know for sure how the content is being compressed or not?

      It’s a good idea during troubleshooting to reduce as many of these variables as possible and, in this case, the tool for that job is cURL. Postman, Insomnia, and similar are great tools but the definitive answer is the library that is likely doing the work under the hood anyways. It’s also much easier to share your results with someone else or document it in the form of a copy/paste command.

      The error I was dealing with was happening in a browser and most browsers have a little feature you can use to get a cURL command from a network request. In Chrome or Safari (and probably others), navigate to the Network tab, find the request, right or CTRL click, and select Copy as cURL.

      If you do that in Safari for a request to my homepage, you’ll get something like this:

      I added the -I flag which tells cURL just to show you the headers of the response.

      Note: If you’re getting a «certificate has expired» message it means that your local cert bundle is not up to date. You can update your local certs by following the link in your terminal or add —insecure to the request for testing.

      You should get an output similar to the below:

      You can see that we told the server «I can speak br » and the server gave us back br . Great! Now lets try another experiment:

      You should get a response like this:

      See the content-encoding header? It’s now gzip . If you run that same command with a -v flag (for verbose output), you’ll see that we’re sending the following:

      The —compressed flag adds the header above and then attempts to decompress the request based on the response header. The br encoding is missing in my case because I am not on the latest cURL version (added in 7.57.0).

      So we have a way to easily modify the request we’re making and see the response that comes back. That should help us figure out a number of content encoding and negotiation issues we might come across. But there’s one problem, the one I was troubleshooting, that we need to test. What if the server tells us that it’s sending content compressed one way but it’s actually compressing it a different way or not at all?

      Using the —compressed flag above, we can see if cURL will decompress the response we get. If I remove the -I flag from our last request above and run it, I get the HTML of my homepage, as expected. If we point that request at a URL that responds with content-encoding: gzip but does not actually return gzipped content, we’ll get an error:

      This endpoint was built using a few lines of Node.js code:

      You can see that the home page just outputs text but the sets a Content-Encoding header before outputting a similar bit of text. If you visit the homepage, you’ll see the text just fine and your headers will tell you that you asked for the 3 compression types but the server responded with no content encoding, meaning no compression was used. All is well.

      If you visit the test page, however, you’ll see an error in Safari and no text will be displayed.

      Источник

      Читайте также:  Error remote origin already exists как исправить
      Оцените статью
      toolgir.ru
      Adblock
      detector