$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: false, vro: false, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
0

Why am i getting an error 405 when i am trying to PUT using batch?PUT without batch works fine.

Nov 13, 2016 at 03:16 PM

177

avatar image
Former Member
onSave: function() { 


 var oDataModel = new sap.ui.model.odata.ODataModel(serviceurl); 
 oDataModel.setUseBatch(true); 
 if (Flag) { 
 oDataModel.setHeaders({ "If-Match": "*" }); 
	oDataModel.update("/entitySet('" + clnt + "')", updateRecord, null, 
	function(oData, oResponse) 
	{ 
 
	},
	function(oError) { 


	} 
 else 
  { 


 	oDataModel.create("/entitySet", createRecord, null, 
	function(oData, oResponse) { 




 	}, 
	function(oError) { 


	});


  }
}

please note that
1. I am using setUseBatch(true) to enable batch request.
2. PUT and POST works without batch.
3. POST works with batch (No issues) but PUT doesnt work 
4. My odata service was generated using a BCO.(so create update methods were auto generated)

The error is 
405 method not allowed
The specified HTTP method is not allowed for the resource identified by the Data Service Request URI
10 |10000 characters needed characters left characters exceeded

Did you already try BATCH in a REST client? Can you share its screenshot and payload content?

Regards,

JK

0
Former Member
Jitendra Kansal

Hi this is my payload. Thanks for the reply :) Please help me as the issue is not solved yet

capture.png (29.4 kB)
0
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Jitendra Kansal
Nov 21, 2016 at 10:48 AM
0

URL for batch should be like: http(s)://smpserver:port/appid/$batch

can you look at last comment mentioned in this thread? https://archive.sap.com/discussions/thread/3852595

try with --changeset only

Regards,

JK

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you so much for your time :) I have solved the issue. The problem was actually because of etags and if-match header.

0