webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

pub.client:restClient return 500 error java.lang.NullPointerException

  • 1.  pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 09:39 AM

    Hi,

    I’m trying to call a REST API using pub.client:restClient and it return a java.lang.NullPointerException.

    Can you please help?

    Tahnk you!


    #API-Gateway
    #webMethods
    #API-Management
    #Service-Designer
    #Integration-Server-and-ESB


  • 2.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 09:55 AM

    Hi Gilberto,

    please provide some more details about your issue, incl. wM version and latest Fixes being applied.
    Check the logs if there is more informations about the cause of a 500 error code (usually indicates that something is not correct in the target server where the API is hosted).

    Regards,
    Holger


    #Service-Designer
    #Integration-Server-and-ESB
    #webMethods
    #API-Management
    #API-Gateway


  • 3.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 11:19 AM

    Hi all,

    Thank you for responde.

    The wM info:
    image

    I’m passing all necessary input. And it’s work for Dev env. For eg:. in TST it enter on error
    And the REST API is work with another client. The REST API is and mocke on the APIGetway.
    image

    The error:
    4dc10f5c62514cd83c2d2cae83ff821ebce413be

    Thank you.


    #API-Management
    #Service-Designer
    #Integration-Server-and-ESB
    #API-Gateway
    #webMethods


  • 4.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 12:08 PM

    Do you mean the REST API is hosted on the APIGateway? If yes, you can also check the logs on the server(API Gateway) side, perhaps the NullPointerException is originating on the server?
    Additionally , from the error screenshot , it looks like you are having a pub.flow:getLastError in your flow, can you check the errorDump to see if there is more information?

    -NP


    #API-Gateway
    #Integration-Server-and-ESB
    #webMethods
    #Service-Designer
    #API-Management


  • 5.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 10:22 AM

    Hi @gfernandes
    Please provide more information to diagnose the issue. You can use the template to clarify the scenario. (Especially these questions)

    1. What product/components do you use and which version/fix level?
    2. Do you get any error messages? Please provide a full error message screenshot and log file.
      There must be a detailed error in the error log , check Logs-> Error in the admin UI.
    3. Have you installed latest fixes for the products

    A few additional observations

    1. What are the inputs you are passing to the pub.client:restClient ? Are all the required inputs passed?

    2. Are you able to call this REST API using any other client , if yes you can compare the inputs passed.

    -NP


    #API-Management
    #Service-Designer
    #webMethods
    #API-Gateway
    #Integration-Server-and-ESB


  • 6.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 12:18 PM

    Hi @gfernandes ,

    Please note that pub.client:restclient is an internal service and should not be used as is. It has to be used in conjunction with consumer Rest API descriptor only. If you not importing a swagger document then you should not be using this service

    This is clearly mentioned in the document as well here is the snippet

    Thanks,
    Sree


    #API-Gateway
    #API-Management
    #Integration-Server-and-ESB
    #Service-Designer
    #webMethods


  • 7.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 12:30 PM

    Hi all,

    Thank you all for responde.

    @Sreekanth_Siddapur_Channakeshava, yes I’m using it in conjunction. I’ve import a sweger and it creat the client
    image

    @Nagendra_Prasad, The REST API is hosted on the APIGatway, but the request is not came to APIGatway.
    In the dump I just have the: java.lang.NullPointerException

    Thank you


    #Integration-Server-and-ESB
    #API-Gateway
    #webMethods
    #Service-Designer
    #API-Management


  • 8.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 12:42 PM

    As @Sreekanth_Siddapur_Channakeshava said you shouldn’t use this service, replace it with pub.client:http
    This service will be hidden in the next release, it was exposed by mistake.
    regards
    John.


    #Integration-Server-and-ESB
    #webMethods
    #API-Gateway
    #API-Management
    #Service-Designer


  • 9.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 12:51 PM

    Hi,

    Sorry, I didn’t understand: “This service will be hidden in the next release, it was exposed by mistake.”

    I’ve already import the sweger to create REST API Descriptor. And the service pub.client:restClient is invoked on the REST connector service. I’m not execut it manually.

    Thank you.


    #Service-Designer
    #API-Management
    #Integration-Server-and-ESB
    #webMethods
    #API-Gateway


  • 10.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri April 01, 2022 03:15 PM

    Hi all,

    Thank you for your help.

    I’ve fix the problem by cast documentToBytes before pass it to REST connector service. It’s working, but I dont think it’s a good solution.
    SAG docs say: body => Document Optional. Body of the REST API request.

    Thank you all.


    #Integration-Server-and-ESB
    #API-Management
    #webMethods
    #API-Gateway
    #Service-Designer


  • 11.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Thu June 16, 2022 04:08 PM

    Hi Gilberto Fernandes

    I am facing similar issue where as my input of rest connector is having body( as a document list )and which is empty(derived from the swagger).
    How should I map data to body of rest consumer connectir(as a document list).I tried mapping from a document list and object list it’s not working


    #webMethods
    #Service-Designer
    #API-Gateway
    #API-Management
    #Integration-Server-and-ESB


  • 12.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Fri June 17, 2022 02:18 AM

    Hi Gilberto,
    Can you provide the swagger or the sample of the body parameter?
    Regards,
    Aishvarya


    #API-Management
    #Service-Designer
    #Integration-Server-and-ESB
    #webMethods
    #API-Gateway


  • 13.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Tue June 21, 2022 12:05 PM

    Hello,

    You just have to define uor structure and use it in body at parametres.

    An parameters egxample:

    “parameters”: [
    {
    “in”: “body”,
    “name”: “body”,
    “required”: false,
    “schema”: {
    “$ref”: …
    }
    }…

    Regards,
    Gilberto


    #webMethods
    #Integration-Server-and-ESB
    #API-Management
    #API-Gateway
    #Service-Designer


  • 14.  RE: pub.client:restClient return 500 error java.lang.NullPointerException

    Posted Tue June 28, 2022 01:41 AM