Ben sözleşmem var:Neden WCF REST POST yönteminde iki bağımsız değişken kullanamıyorum?
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Xml, UriTemplate = "GetCategoriesGET/{userIdArg}", BodyStyle = WebMessageBodyStyle.Bare)]
List<Video> GetVideosGET(string userIdArg);
[WebInvoke(Method = "POST", UriTemplate = "evals")]
[OperationContract]
void SubmitVideoPOST(Video videoArg, string userId);
Ve uygulayan yöntemler vardır:
public List<Video> GetVideosGET(string userIdArg)
{
List<Video> catsToReturn = new List<Video>();
if (Int32.Parse(userIdArg) == 1)
{
catsToReturn = catsForUser1;
}
else if (Int32.Parse(userIdArg) == 2)
{
catsToReturn = catsForUser2;
}
return catsToReturn;
}
public void SubmitVideoPOST(Video videoArg, string userId)
{
}
ben göz attıklarında:
:Server Error in '/' Application. Operation 'SubmitVideoPOST' of contract 'IVLSContentService' specifies multiple request body parameters to be serialized without any wrapper elements. At most one body parameter can be serialized without wrapper elements. Either remove the extra body parameters or set the BodyStyle property on the WebGetAttribute/WebInvokeAttribute to Wrapped.
http://localhost:52587/Api/Content/VLSContentService.svc/GetCategoriesGET/1
Im bu hatayı alıyorum
POST için yeni bir yöntem eklediğimde (Buraya erişmeyi denediğim) Get isteği üzerine yalnızca bu hatayı almaya başladım, bu ne anlama geliyor? Birden fazla argüman kullanabilir miyim?
Şerefe evet üzgünüm, tümüyle kafamı karıştırdı, ama şimdi aldım, teşekkürler! – Exitos
Yaptım ama çalışmadı – AMH
Aynı şeyi yaptım, ama işe yaramadı. BodyStyle'ı çıkardım, sonra işe yaradı –