Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> WCF Data Services (OData). Action method gets no parameters
 

Pages: 1
Bugs & Issues
WCF Data Services (OData). Action method gets no parameters
Page:1/1 

  Print all messages in this thread  
Poster Message
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 29-Aug-2013 18:38:50. Goto attachments  
I have created a OData service (sln enclosed), with Authentication, Operations and an Action with a single parameter:
Code:

[WebInvoke(Method = "POST")]
public void DeletePeople(string guidsToDelete) {...}


The problem is that the 'DeletePeople' method is called, but with empty parameters (guidsToDelete = null)
even when the parameter value is included in the HTTP POST body.
Code:

// Fiddler capture seems ok:
POST BODY:
{"guidsToDelete":"f767f533-5143-4cd1-8b8f-375594533f81"}

HEADERS:

POST /Person.svc/DeletePeople HTTP/1.1
Host: localhost:52011
Connection: keep-alive
Content-Length: 56
Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1
MaxDataServiceVersion: 2.0
Origin: http://localhost:52011
DataServiceVersion: 2.0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
Content-Type: application/json;odata=verbose
Referer: http://localhost:52011/Index.htm
Accept-Encoding: gzip,deflate,sdch
Accept-Language: es,en-US;q=0.8,en;q=0.6


I have tried both with the .Net (WCF Data Services 5.3 & 5.6) and the JS (JayData) clients, with the same results.

Anybody with the same problem?

TO REPRODUCE:
1. Install the Microsoft.Data.Services package in both the client and the service projects
2. Modify the conn string in the web.config file
  Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 29-Aug-2013 23:16:29.  
Futher reading of the OData standard force parameters to the URL, even in POST requests (body parameters are not allowed) http://www.odata.org/documentation/uri-conventions/#6_Service_Operation_Parameters

I'll try it tomorrow morning


  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14639 posts
# Posted on: 29-Aug-2013 23:19:23.  
I'll close this thread for now, it will be automatically opened once you reply on it.

Waiting your trial on it.
  Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 30-Aug-2013 09:44:01.  
It was exactly that:

In System.Data.Services.Client, send the parameters as UriOperationParameter instead of BodyOperationParameter.

Still trying to figure out how to set it with JayData (JavaScript). If connecting to a POST operation seems to send the parameters in the message body by default:

Code:
'DeletePeople': { type: $data.ServiceOperation, method: 'POST', params: [{ name: 'guidsToDelete', type: 'Edm.String' }] }


Llblgen rocks (for almost three years for us, right now)


  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.