Re: Introducing vibe.d! SOAP .. REST?

2012-05-03 Thread bls

Am 30.04.2012 08:38, schrieb Sönke Ludwig:

If you mean automatic generation of a REST interface for an existing D
interface, then it's definitely planned. I can imagine a sloppy version
where the HTTP method is always POST or can be POST/GET as desired by
the client. But I would also like to have a more expressive version,
where the HTTP method is inferred from the D method somehow and maybe it
would also be possible to specify a sub path for each method.

Sönke


Yes, this is what I am asking for. I think POST/GET is not enough.

Should be POST GET PUT DELETE

I would be fantastic if vibe.d can implement a REST SERVER following 
this guideline :


The JsonRestStore follows
RFC 2616 (http://www.ietf.org/rfc/rfc2616.txt) whenever possible to 
define to interaction with server. JsonRestStore uses an HTTP GET 
request to retrieve data, a PUT request to change items, a DELETE 
request to delete items, and a POST request to create new items. It is 
recommended that the server follow a URL structure for resources:


/{Table}/{id}

This URL will be used to retrieve items by identity and make 
modifications (PUT and DELETE). It is also recommended that a /{Table}/ 
URL is used to represent the collection of items for the store. When a 
query is performed, any query string is appended to the target URL to 
retrieve the results of the query. The JsonRestStore expects the results 
to be returned in an array (not in an object with an items property like 
some stores). The store will also POST to that URL to create new items.


When creating new items, the JsonRestStore will POST to the target URL 
for the store. If your server wants to assign the URL/location for the 
newly created item, it can do so by including a Location header in the 
response:


Location: http://mysite.com/Table/newid

The server can also assign or change properties of the object (such an 
id or default values) in the response to a POST (or any other request), 
by simply returning the updated JSON representation of the item in the 
body of the response.


Note that in PHP, sometimes setting the Location will erroneously 
trigger a 302 status code which will cause JsonRestStore to fail. Per 
RFC 2616, the correct response to a POST that creates a new resource is 
to return a 201 status code with the Location header. In PHP, you must 
set the status code as well as the Location header if you want to avoid 
a 302 response.


Re: Introducing vibe.d! SOAP .. REST?

2012-05-03 Thread bls

Am 03.05.2012 11:22, schrieb bls:

Should be POST GET PUT DELETE

I would be fantastic if vibe.d can implement a REST SERVER following
this guideline :


A very interesting read regarding implementing a rest server (PHP)

http://www.gen-x-design.com/archives/create-a-rest-api-with-php/

Bjoern


Re: Introducing vibe.d! SOAP .. REST?

2012-05-03 Thread Chris NS
I've been playing around with vibe in my free time the last few 
days, and here are the beginnings of a stab at REST:

https://github.com/csauls/zeal.d/blob/master/source/zeal/http/router.d

Admittedly it rips off the Rails way of recognizing and pathing 
the REST actions, but I admit a small bias as someone who uses 
Rails often.  That said, I've been trying to dream up a more 
D-like way to do it.


Re: Introducing vibe.d! SOAP .. REST?

2012-05-03 Thread Kagamin

On Thursday, 3 May 2012 at 09:22:23 UTC, bls wrote:

Should be POST GET PUT DELETE


I'm afraid, some proxies may cut unusual http verbs. SVN relies 
on them and if a proxy is not nice, it gets broken.


Re: Introducing vibe.d! SOAP .. REST?

2012-04-30 Thread Sönke Ludwig

Am 29.04.2012 23:41, schrieb bls:

Seems that my last reply was jammned or whatever .. so in short
x509 certificate support... Why not ?


Do you mean for SSL or package signing or something else? They are 
currently used for SSL, but currently there is no certificate validation 
on the client side.




SOAP/WSDL
SOAP service consuming is what makes my bread and butter nowadays but
to face it : Parsing a WSDL stream sucks
Creating a SOAP service in D is  Ouch.. Consuming a SOAP/WSDL in D
is super.. anyway, Smart Devices are not realy interested in
SOAP/WSDL...
Means Vibe.d should support REST out of the box.

I hope that you give  Interface to REST -- (code-gen-wise) a try..
Bjoern


If you mean automatic generation of a REST interface for an existing D 
interface, then it's definitely planned. I can imagine a sloppy version 
where the HTTP method is always POST or can be POST/GET as desired by 
the client. But I would also like to have a more expressive version, 
where the HTTP method is inferred from the D method somehow and maybe it 
would also be possible to specify a sub path for each method.


Sönke