locked
error in api POST - message on android not as web ? RRS feed

  • Question

  • User-1846805900 posted

    Hi

    please i have an api for creating order and i have add my site to host working with plesk 17.8.11

    when i call api from web i got error

    {
        "errors": {
            "server_error": [
                "Object reference not set to an instance of an object."
            ]
        }
    }

    and when i call it from android i got this error

    java.net.protocolexception unexpected status line {"d":null}http/1.1 200 ok

    so please how can i resolve it ?

    Thursday, February 21, 2019 4:17 PM

All replies

  • User475983607 posted

    Hi

    please i have an api for creating order and i have add my site to host working with plesk 17.8.11

    when i call api from web i got error

    {
        "errors": {
            "server_error": [
                "Object reference not set to an instance of an object."
            ]
        }
    }

    and when i call it from android i got this error

    java.net.protocolexception unexpected status line {"d":null}http/1.1 200 ok

    so please how can i resolve it ?

    The null exception is caused by accessing an object that has not been initialized.  This is the most common bug in programming. 

    I recommend running your code through the debugger.  Unfortunately you're showing us Java code and this is a .NET forum.  Share your .NET code if you want forum members to debug your code.  I recommend debugging on your own...

    Thursday, February 21, 2019 5:04 PM
  • User1120430333 posted

    "Object reference not set to an instance of an object."

    If that is the error message you are getting, then the message means code is trying to reference an object that is not there in memory. It's a null valued object. It's basic OO 101 on class vs object vs instance. It doesn't matter if .NET or Java OO language platform is being used.

    https://alfredjava.wordpress.com/2008/07/08/class-vs-object-vs-instance/

    This is also an indication that you do not have Global Exception Handling in the WebAPI solution to catch and log all unhandled exceptions to a log  file the error exception message  and stack trace so that you can review this information in the log and pinpoint where the exception was thrown.

    Thursday, February 21, 2019 5:04 PM