Publishing Web Service (PUT/DELETE) 405- Method Not Allowed

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
Speedlime
Posts: 43
Joined: Wed Feb 03, 2021 2:52 am

Publishing Web Service (PUT/DELETE) 405- Method Not Allowed

Post by Speedlime »

Afternoon
Hope someone can help with this. Not sure if it is the API definitions in LANSA or Postman is the issue.

I have setup my path and Operations as per default template generated code.
2
2
apiPath-OP.png (20.08 KiB) Viewed 25865 times
It is my understanding that when calling this API with the Delete method it is picked up by the verb set to Delete and the API knows what routine to run.
2
2
apiPath-OP.png (20.08 KiB) Viewed 25865 times
Issue only happens on PUT and DELETE methods (GET and POST work fine) Not sure if I need to configure something else in the definition in the SM or if there is something missing in POSTMAN.

I am hoping someone has had this issue before.
Thanks for the help
Attachments
1
1
Postman-Delete.png (47.9 KiB) Viewed 25865 times
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: Publishing Web Service (PUT/DELETE) 405- Method Not Allowed

Post by Dino »

Look for the webmodules.conf file in the lansa/run/conf folder and confirm that the correct entries for that are there, once. Recompiling should recreate the entries.
Speedlime
Posts: 43
Joined: Wed Feb 03, 2021 2:52 am

Re: Publishing Web Service (PUT/DELETE) 405- Method Not Allowed

Post by Speedlime »

Thanks Dino, Conf file looks good.
WebModules.png
WebModules.png (21.8 KiB) Viewed 25819 times
Interesting thing, I added the debug entry into the delete endpoint, however it does not get to the server module when I call API through Postman. Works fine on the GET and POST endpoints. which leaves me with is the server blocking it or is Postman .
I can write the create update and delete using POST and unique endpoints for each, but that LANSA generated template code implies that the PUT and DELETE methods should work.
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: Publishing Web Service (PUT/DELETE) 405- Method Not Allowed

Post by Dino »

Those verbs work, I use them in this exercise with v15 150050

viewtopic.php?f=4&t=2617

What version are you using?
Speedlime
Posts: 43
Joined: Wed Feb 03, 2021 2:52 am

Re: Publishing Web Service (PUT/DELETE) 405- Method Not Allowed

Post by Speedlime »

I have got it to work by doing this.

Removed Native WebDAVModule from the Modules section in the IIS on the windows web server.
I also added the verbs into the web.config
<verbs>
<add verb="Delete" allowed="true" />
<add verb="Put" allowed="true" />
<add verb="Post" allowed="true" />
<add verb="Get" allowed="true" />
</verbs>

I used CURL a utility in Windows to call API outside of Postman to verify that access was being denied at server level, this was backed up by the logs in the IIS.
Thanks to Stack Overflow the resolution to the issue was applied and worked.
Speedlime
Posts: 43
Joined: Wed Feb 03, 2021 2:52 am

Re: Publishing Web Service (PUT/DELETE) 405- Method Not Allowed

Post by Speedlime »

Thanks Dino,
We are on the same version, example is great and close to how I have developed my solution.
Not being a web developer or web admin it is all a bit of a dark art. Thanks for looking. Solution to my issue above.
Post Reply