OData4j sample implementation for POST/Create operations - odata4j

Where can I find sample implementaion for OData Create operation (POST in REST) using odata4j for POJO. I have already checked InMemoryProducerExample but no help.
Also some pointers on how to use $filter for Query operations...
Thanks in advance, Avishek.

Related

Any benefits to using WCF for this?

I need to receive XML data from HttpPost requests. Currently I use HttpWebRequest to send the request and I convert the request to xml with StreamReader and XDocument.Parse.
Are there any benefits to switching over to WCF? Thanks!
If you don't plan to dramatically extend your application and only want to switch to WCF so that you are using it, no. :-)
WCF will give you some more flexibility - you could for example consume data in other data formats or from other transport formats (Named Pipes, ...)
I hope i understood your question correctly !!!
The use of WCF lies where you know that both the sending as well as receiving end share the same data contract.
I think in your case, using WCF will benefit if both are MS application and the contract is not supposed to change very frequently.

In WCF, how do I convert a Datatable to a format that will output in JSON store format without classes

So here's the problem - I have a DataTable I want WCF (.NET 3.5) to send out in a JSON store format commonly used in ExtJS, etc - basically "Rows[{"Field1":value,"Field2":value},{...}]" but I cannot find the right structure to feed back to the Operation contract to send it out in this format.
So any ideas, or any further info needed.
Thanks, in advance!
AndyPC, unfortunately, you're out of luck.
If you're dealing with an object whose type is an IXmlSerializable, the WCF JSON serializer delegates to IXmlSerializable methods first, gets the serialized XML out of them, wraps the XML in a JSON string, and just passes that on. This is one of the major weaknesses of the WCF JSON model in .NET 3.5. I think the entity framework (WCF Data Services) technologies try to handle this more elegantly, but not sure. I'd recommend manually using the JSON serializer and crafting up a string or a manual serialization mechanism that does what you want...

Alternative for dataset/datatable returned from ajax enabled wcf service?

I have seen blogs and people saying Returning dataset/datatable from an ajax enabled wcf service is a bad idea.... I have gone through this Scott Hanselman's blog about datasets fr0m wcf...
So what is the alternative for dataset returned form ajax enabled wcf service?
Well, basically, on your server side (where your service method is implemented), either use straight ADO.NET SqlDataReader and assemble the data retrieved into custom classes, or use an ORM like Linq-to-SQL or the Entity Framework or NHibernate or ... or... or..... to do this job.
Then, when you need to return data, either return a List<MyClass> or some other structure, which gets serialized into JSON or XML and doesn't carry the overhead of a whole DataSet/DataTAble.

Mapping a WCF request message to the underlying operation

I need to know what operation is being invoked by examining a request Message object in an IDispatchMessageInspector.
What is the best way to do this?
There's really no 100% sure way of doing this, because IDispatchMessageInspector.AfterReceiveRequest() runs before the dispatcher has matched the message to an actual operation on the service. That said, if you're using the default IDispatchOperationSelector, then it's possible to build a map that matches SOAP Action names with operation names during ApplyDispatchBehavior(). I have a blog post that talks a little bit about this here.
There's a bit of an example of how to build this map on some code here.

how to get data through a stored procedure in wcf?

I am working on a wcf application where i want to access some columns from a table (prefebly via stored procedure) through wcf and pass it to client. I have searched a lot on the google but unable to find a good example of it. Can some one help me please.
Thanks in advance
Any of the DB APIs will allow you access to SQL. Recently, I've used mostly the Entity Frameworks with my WCF services. All was fine and dandy, once you get the connection string(s) worked out to each of your databases.
erm write a datacontract serializable class and have a method on it to populate itself using a connection object?
Make sure your types are serializable. Based on your comment to PeanutPower's answer it looks like you'll need to make sure TBL_CONTENTTEMPLATE is serializable. Also verify you have your service contract defined on the client side to accept a collection type of System.Collections.Generic.List, the default is System.Array and I've run into problems in the past when the client contract was misconfigured in this way.