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

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!

1 Like

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

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

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.

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

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

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

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.

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.

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.

1 Like

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

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

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

Hi Gilberto,

Please provide the sample schema, which is the cause of the issue. If possible provide the complete swagger.

image001.png

image002.png

image003.png

image004.png

image005.png

image006.png

image007.png

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.