本文介绍了在编程中抛出400错误的Restful service post方法url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 post方法的操作方法(费用项目是类): WebInvoke(方法:= POST,UriTemplate:= CreateExpenseItem,RequestFormat:= WebMessageFormat.Json,ResponseFormat:= WebMessageFormat.Json,BodyStyle:= WebMessageBodyStyle.Bare)_ Function CreateExpenseItem( ByVal objExpense As ExpenseItem) As 整数 实施方法: 公共 功能 CreateExpenseItem( ByVal objExpense As ExpenseItem) As Integer Implements IHrmsService.CreateExpenseItem Dim 输出正如 整数 输出= objEmployee.SaveExpenseDetails _ (_ objExpense.ExpensemasterID,objExpense.ExpenseID, objExpense.Expensename,_ objExpense.ExpenseDate,_ objExpense.Amount,objExpense.Description,_ objExpense.EmpID _ ) 返回输出 结束 功能 使用时发生400错误代码中的url但我可以使用Get方法: http://116.145.199.252/ServiceHRMS/HrmsService.svc/web/CreateExpenseItem 请有人帮助我.. 我做错了什么?解决方案 Operation method for post method (Expense item is class) :WebInvoke(Method:="POST", UriTemplate:="CreateExpenseItem", RequestFormat:=WebMessageFormat.Json, ResponseFormat:=WebMessageFormat.Json, BodyStyle:=WebMessageBodyStyle.Bare) _Function CreateExpenseItem(ByVal objExpense As ExpenseItem) As IntegerImplementation method :Public Function CreateExpenseItem(ByVal objExpense As ExpenseItem) As Integer Implements IHrmsService.CreateExpenseItem Dim Output As Integer Output = objEmployee.SaveExpenseDetails _ ( _ objExpense.ExpensemasterID,objExpense.ExpenseID, objExpense.Expensename, _ objExpense.ExpenseDate, _ objExpense.Amount, objExpense.Description, _ objExpense.EmpID _ ) Return Output End FunctionIt is throwing 400 error while using through url in code but Im able to use Get methods :http://116.145.199.252/ServiceHRMS/HrmsService.svc/web/CreateExpenseItemPlease can anyone help me .. What Im I doing wrong ? 解决方案 这篇关于在编程中抛出400错误的Restful service post方法url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-19 22:32