Google Groups Home
Help | Sign in
add a service to amplee tutorial
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
IP  
View profile
 More options Apr 4, 7:40 pm
From: IP <ipesen...@gmail.com>
Date: Fri, 4 Apr 2008 16:40:24 -0700 (PDT)
Local: Fri, Apr 4 2008 7:40 pm
Subject: add a service to amplee tutorial
Hi,

After much effort I was able to get amplee running with dejavu using
mysql.  To make sure I understand how a service is set up I tried to
add a service and repeat the tutorial.  I'm not certain I have the
terminology correct - in the xml service document vocabulary I guess
I'm trying to add a collection (and workspace I think as well).

The basic question is - what are the steps to create or add a service
to amplee?  As far as I understand I need to define a new workspace in
service.xml and explicitly mount the service in application.py.  If I
want the same behavior as in the amplee tutorial I don't need to
change anything else.  What am I missing?

It does not seem to work as above.  I modify the service.xml file of
the tutorial so that it looks like the following.  I just tacked on a
second collection called "FeedFeed" below the given one.

<?xml version="1.0" encoding="UTF-8"?>
<app:service xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app" xml:lang="en" xml:base="http://
localhost:8080/">
  <app:workspace>
    <atom:title type="text">Blog</atom:title>
    <app:collection href="service/blog/">
      <atom:title type="text">My blog and related thoughts</
atom:title>

      <!-- public URI of the blog -->
      <atom:link href="blog/" type="application/atom+xml;type=feed"
rel="alternate"/>

      <app:accept>application/atom+xml;type=entry</app:accept>
      <app:accept>image/png</app:accept>
      <app:accept>application/x-www-form-urlencoded</app:accept>
      <app:categories>
        <atom:category term="me" scheme="http://people.net" label="Me me me" /


      </app:categories>
    </app:collection>
  </app:workspace>
  <app:workspace>
    <atom:title type="text">FeedFeed</atom:title>
    <app:collection href="service/feedfeed/">
      <atom:title type="text">FeedFeed service</atom:title>

      <!-- public URI of the blog -->
      <atom:link href="feedfeed/" type="application/atom
+xml;type=feed" rel="alternate"/>

      <app:accept>application/atom+xml;type=entry</app:accept>
      <app:accept>image/png</app:accept>
      <app:accept>application/x-www-form-urlencoded</app:accept>
      <app:categories>
        <atom:category term="ff" scheme="http://feedfeed.net"
label="Feed food ff" />
      </app:categories>
    </app:collection>
  </app:workspace>
</app:service>

I then update "create_serving_applications" in application.py so that
the function looks like so:

    def create_serving_applications(self):
        self.service =
ServiceHandler(self.servdoc.to_service().xml(indent=True))

        # Mount the blog AtomPub web service
        c = self.servdoc.get_collection_by_uri('http://localhost:8080/
service/blog/')
        self.service.blog = CollectionHandler(c)
        self.service.blog.paging = CollectionPagingHandler(c)

        # Mount the FeedFeed web service
        c = self.servdoc.get_collection_by_uri('http://localhost:8080/
service/feedfeed/')
        self.service.ff = CollectionHandler(c)
        self.service.ff.paging = CollectionPagingHandler(c)

The service starts and I can interact with the blog collection as in
the tutorial.  When I try to get the new collection

r, c = h.request('http://localhost:8080/service/feedfeed/')

I get a server error and the traceback is

  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/CherryPy-3.1.0beta3-py2.5.egg/cherrypy/
_cprequest.py", line 588, in respond
    cherrypy.response.body = self.handler()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/CherryPy-3.1.0beta3-py2.5.egg/cherrypy/
_cpdispatch.py", line 24, in __call__
    return self.callable(*self.args, **self.kwargs)
TypeError: GET() takes exactly 1 argument (2 given)

Any hints much appreciated.  Once I figure this out I'll be trying to
modify the behavior of the http calls to the collections - I'm
guessing that's where the real fun will begin.  Thanks ahead of
time!
Igor.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
IP  
View profile
 More options Apr 5, 10:26 pm
From: IP <ipesen...@gmail.com>
Date: Sat, 5 Apr 2008 19:26:35 -0700 (PDT)
Local: Sat, Apr 5 2008 10:26 pm
Subject: Re: add a service to amplee tutorial
Ok, I figured it out.  It appears that the path to the service is not
really set in "service.xml" but by the following lines in
application.py (circa line 97)

        # Mount the blog AtomPub web service
        c = self.servdoc.get_collection_by_uri('http://localhost:8080/
service/blog/')
        self.service.blog = CollectionHandler(c)
        self.service.blog.paging = CollectionPagingHandler(c)

So "self.service.blog" is what determines the path.  So when you
request as follows:

it doesn't matter what you specified in service.xml as long as the
commands in application.py are as follows:

        # Mount the blog AtomPub web service
        c = self.servdoc.get_collection_by_uri('http://localhost:8080/
whatever/you/put/in/xml/file/')
        self.path.to.my.service = CollectionHandler(c)
        self.path.to.my.serivce = CollectionPagingHandler(c)

Igor.

On Apr 4, 4:40 pm, IP <ipesen...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sylvain Hellegouarch  
View profile
 More options Apr 6, 5:21 am
From: Sylvain Hellegouarch <s...@defuze.org>
Date: Sun, 06 Apr 2008 11:21:31 +0200
Local: Sun, Apr 6 2008 5:21 am
Subject: Re: add a service to amplee tutorial
Hi,

I'm sorry for not helping you on that one it appears I missed the
message (maybe got into my spam box).

The thing is, although amplee does not require CherryPy, the tutorial
and examples provided are based on CherryPy 3 which I do not explain
much in the examples I must admit.

You are right that matters to serve the service document is how you
mounted the application that will handle requests associated with it.

amplee does not actually use that value itself so you canb mount your
document wherever you want.

- Sylvain

IP a écrit :


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eric Larson  
View profile
 More options Apr 6, 1:50 pm
From: "Eric Larson" <ionr...@gmail.com>
Date: Sun, 6 Apr 2008 12:50:28 -0500
Local: Sun, Apr 6 2008 1:50 pm
Subject: Re: add a service to amplee tutorial
Hi,

Along those lines, if you wanted you could filter the service document
response with XSLT pretty easily using XSLTemplates
(http://code.google.com/p/xsltemplates). You could use relative URIs
in your service doc and add a xml:base according to the current
request.

Yes, XSLTemplates is my own project, but it really seemed like a handy
way to filter XML output like a service document or atom feed. So,
this is not *entirely* self promotion ;)

It uses Amara/4Suite so it doesn't add an extra requirement if you're
using Amplee.

Eric


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google