Method Not Allowed – error trouble shoot
This is a beginner’s guide to trouble shoot this error!
When testing OData services in Gateway Client, it is common to get the error “Method not allowed” if you are unsure of the URL format to be used for various HTTP methods viz. GET, POST etc.
What does this error mean?
This error means that the URL format you have entered does not correspond to any valid formats. This means, none of the methods viz. GET_ENTITY, GET_ENTITYSET, DELETE_ENTITY, CREATE_ENTITY is called.
You can verify this by placing a breakpoint inside these methods and you will see that control does not reach there.
Error log in transaction /IWFND/ERROR_LOG would simply say:
“The specified HTTP method is not allowed for the resource identified by the Data Service Request URI“.
Dah! That is actually true! But it is not giving enough information for a beginner like me.
Debug request handling steps:
In transaction /IWFND/ERROR_LOG, select the error log entry and then click on “Call Stack” button.
In the call stack, you should the method /IWCOR/IF_DS_PROCESSOR~PROCESS.
Method /IWCOR/IF_DS_PROCESSOR~PROCESS of class /IWCOR/CL_DS_PROC_DISPATCHER handles the request and verifies the URL formats and selected methods against allowed formats.
This method does this verification based on the URI types – line number 29 onward. If you look closely, there are different methods allowed for different URI types.
For example: You can execute POST method only for below URI types:
Well, now what do these URI types mean and how do I know what is the exact format of these?
These are defined as constants in interface /IWCOR/IF_DS_URI as shown below and the description shows the URL format for that type:
Of course, this may not be an easy way to verify URL formats. But once we know this, tracing the error and finding it out why exactly it is failing is easier 😉
Further study: You can refer to OData specifications for URL formats -http://www.odata.org/documentation/odata-version-2-0/uri-conventions/