Author Message
rajanip.instruments.com
Joined: Feb 18, 2021
Messages: 16
Offline
Hi,

We are trying to test REST API from OD in simulation mode. We have the REST API working fine when tested thorugh SOAP UI. So configured the WS in OD with the request body as suggested by avaya for one of the issues raised where without adding JSON, it was not even saving configuration and returning "content is not allowed in prolog":

JSON {"login_id": "test","api_key": "123b45d23baasetfdet912d3a3c97cc0"}

But here it is returning error as :

Servlet Exceptionjava.lang.RuntimeException: org.apache.axis2.AxisFault: <error_code>invalid_request</error_code>


Please advise.

Thanks,
Rajani
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Not sure which version of OD you are using. There is an issue with 8.0. Not sure if it is related. You can take a look at this post first:

https://www.devconnectprogram.com/forums/posts/list/24511.page
rajanip.instruments.com
Joined: Feb 18, 2021
Messages: 16
Offline
Hi Wilson,

Thank you.
We have OD 8 and it worked after updating the plugin. We need to use bearer authentication for other REST WS calls. Couldn;t figure out how that can be done with authenticaiton options OD has. How do we do that and or any example if supported would be appreciated. Please advise.


Thanks,
Rajani
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
OD does not have any particular implementation on this. It seems all it takes is sticking the token in the http header. You can try to do that in the REST operation. The editor allows you to add headers.
rajanip.instruments.com
Joined: Feb 18, 2021
Messages: 16
Offline
OK ..Was able to get the WS working with required header having the token being passed when tried through SOAP UI.

But when we try the same with same configuration getting error as

HTTP TRANSPORT, 404 ERROR: NOT FOUND
EXCEPTION: Transport error: 404 Error: Not Found
org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found

Could you please tell us what could be issue here as it is failing from OD only?

Thanks,
Rajani
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Not sure what exactly is wrong but 404 error typically means page not found (end point is not correct).
rajanip.instruments.com
Joined: Feb 18, 2021
Messages: 16
Offline
Hi WIlson,

We were able to get it working.

We have another issue - for a REST API call which is a GET and expects header parameters Content-Type and accept as application/json, getting error as "Caused by: org.apache.axis2.AxisFault: Transport error: 415 Error: Unsupported Media Type".

We have tried removing "accept" from header and also tried passing the content type as "text/xml" but error is same....

It is working from SOAP UI but failing from OD only.

Can you please advise?


Thanks,
Rajani
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
This is more a server message that rejects the request. Not sure why a Get request is a application/json content type to begin with.
rajanip.instruments.com
Joined: Feb 18, 2021
Messages: 16
Offline
Ok but is it working from SOAP UI but failing only from OD.
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
I think it has to do with the response. You would need to check the content type in the response.
rajanip.instruments.com
Joined: Feb 18, 2021
Messages: 16
Offline
it is application/json
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Can you show some log from the app's data/trace.log?
rajanip.instruments.com
Joined: Feb 18, 2021
Messages: 16
Offline
Hi Wilson,

Please find attached the trace log.

Thank you.
Filename tomcat9-stdout.2021-09-16.log [Disk] Download
Filename trace.zip [Disk] Download
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
This is what I found about this error. It says it has to do with the content type of the request payload and what the service is expecting. Without having experienced with this particular web service, I can't really tell you what is going on.

6.5.13. 415 Unsupported Media Type

The 415 (Unsupported Media Type) status code indicates that the
origin server is refusing to service the request because the payload
is in a format not supported by this method on the target resource.
The format problem might be due to the request's indicated
Content-Type or Content-Encoding, or as a result of inspecting the
data directly.
rajanip.instruments.com
Joined: Feb 18, 2021
Messages: 16
Offline
Hi Wilson,

We did some debugging on API end and noticed that server is receiving the content-type as "application/x-www-form-urlencoded; charset=UTF-8" instead of "application/json" what we are passing from OD end.

We even tested from SOAP UI and POSTMAN, the get request is working fine. So issue we are seeing happening when requested from OD.


Please advise.

Thanks,
Rajani
Go to:   
Mobile view