2012-07-17 122 views
0

我搜索了四周,但我真的不知道如何解释我必须使用的其他服务的wadl文件。 (包括WADL在底部..)了解wadl文件的休息服务

就像我以为像这样简单的GET请求应该工作:

http://<IP HERE>:8080/RestZone-it/resources/be.zonit.rest.data?plaats=<SOME LOCATION> 

(荷兰 - >英语) 国家地点=位置

但它不工作,我仍然得到所有的数据.. 有人可以解释如何使用该服务? (多一点,然后只是告诉我该怎么做这个单一的请求,将不胜感激^^)响应

<application xmlns="http://research.sun.com/wadl/2006/10"> 
    <doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey: 1.8 06/24/2011 12:17 PM"/> 
    <resources base="http://<IP-HERE>:8080/RestZone-it/resources/"> 
     <resource path="be.zonit.rest.data"> 
      <method id="create" name="POST"> 
       <request> 
        <representation mediaType="application/xml"/> 
        <representation mediaType="application/json"/> 
       </request> 
      </method> 
      <method id="findAll" name="GET"> 
       <response> 
        <representation mediaType="application/xml"/> 
        <representation mediaType="application/json"/> 
       </response> 
      </method> 
      <method id="edit" name="PUT"> 
       <request> 
       <representation mediaType="application/xml"/> 
       <representation mediaType="application/json"/> 
       </request> 
      </method> 
      <resource path="{id}"> 
       <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="id" style="template" type="xs:int"/> 
       <method id="find" name="GET"> 
        <response> 
         <representation mediaType="application/xml"/> 
         <representation mediaType="application/json"/> 
        </response> 
       </method> 
       <method id="remove" name="DELETE"/> 
      </resource> 
      <resource path="count"> 
       <method id="countREST" name="GET"> 
        <response> 
         <representation mediaType="text/plain"/> 
        </response> 
       </method> 
      </resource> 
      <resource path="{from}/{to}"> 
       <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="to" style="template" type="xs:int"/> 
       <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="from" style="template" type="xs:int"/> 
       <method id="findRange" name="GET"> 
        <response> 
         <representation mediaType="application/xml"/> 
         <representation mediaType="application/json"/> 
        </response> 
       </method> 
      </resource> 
     </resource> 
    </resources> 
</application> 

<data> 
    <aantalDeelnemers>50</aantalDeelnemers> 
    <begin>15:30</begin> 
    <datum>5/07/2012</datum> 
    <einde>1:00</einde> 
    <gemeente>Gent</gemeente> 
    <huisnr>2</huisnr> 
    <id>1</id> 
    <indoor>0</indoor> 
    <omschrijving> 
    Gent Jazz Festival vindt dit jaar plaats van 5 t.e.m. 14 juli in de tuinen van De Bijloke in Gent. 
    </omschrijving> 
    <ownerID>1</ownerID> 
    <plaats>Bijlokesite</plaats> 
    <straat>Godshuizenlaan</straat> 
    <titel>Gent Jazz Festival</titel> 
</data> 
+0

没有什么关于WADL中的“* plaats *”参数,你为什么认为它应该起作用,而不是简单地忽略它? – 2012-07-17 11:25:42

+0

由于rest是一个框架,我认为这将是基本的功能来过滤其余数据库中的参数。我现在编辑我的帖子以显示示例回复。 (对不起,我忘记了这一点,做了一些'不清楚' – Spyral 2012-07-17 11:48:11

回答

0

试试这个网址:

http://<IP HERE>:8080/RestZone-it/resources/be.zonit.rest.data/<SOME LOCATION> 
+0

我不认为这是有效的..据我所知,当使用休息时,'资源'如:是你可以放在.... data /后面的东西,所以使用你刚刚给出的404提供了一个404,因为它没有被指定回复。 – Spyral 2012-07-17 11:46:49

+0

根据http://www.w3.org/Submission/ wadl /它看起来像我的建议是纠正。确保是一个整数,是一个有效的ID。WADL指定ID是一个整数,但似乎你想指定一个plaats(字符串?)。没有资源直接查找plaats的模板。 – pilotcam 2012-07-17 13:58:25