List Info

Thread: ATOMPUB binding




ATOMPUB binding
user name
2007-07-17 04:06:33
We have a first attempt at a ATOMPUB binding sitting on a
server here
that has quite made it to the outside world. It was mostly
written by
Megan Beynon - she put a lot of work in but then had to move
to
another project.

The essential idea is that you can define a proxy for a
remote
component that talks ATOMPUB - something like this:

   /**
     * A reference to the contact feed service.
     *
     * reference
     * binding.atom ht
tp://localhost/examples/SCA/Atom/ContactFeed.php
     */
    public $contact_feed;

Then you can call methods like create, retrieve, update,
delete and
enumerate on the proxy, and it will talk ATOMPUB to the far
end, where
there is a component that looks like this:

 * service
 * binding.atom
 */
class ContactFeed {
 .../...

that contains create, retrieve methods, etc. Of course like
the other
bindings that talk a well-known web protocol the idea is not
just to
go SCA to SCA, but that a client using the proxy can consume
and
publish to atom feeds that are produced by some other
non-SCA
producer, and likewise the feed that an SCA component
produces can be
consumed and published to by anything that talks ATOMPUB.

So, although it's not finished, it might as well be not
finished
sitting in the outside world where people can see it, as
sitting in
the dark on a server here inside IBM, so I propose to check
it into
PECL on a development branch, and work occasionally on it
there (I'll
make sure it does not get in to a release until it is a bit
more
robust.) I'll put a known-problems-and-todo-list up on this
google
group as a page also.

If anyone has an application where they would really like
such a
thing, but does not mind if progress is a little slow, I'd
be glad to
hear from them. Also, if anyone is excited by the idea of
taking a
look at it and making it better I'd like to hear from them
too!

Matthew


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: ATOMPUB binding
user name
2007-07-17 04:08:33
Shame I didn't read it through carefully before posting -
that should
be
"that has *not* quite made it to the outside world
..."

On Jul 17, 10:06 am, Matthew Peters <matthew.f.pet...googlemail.com>
wrote:
> that has quite made it to the outside world. It was
mostly written by


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: ATOMPUB binding
user name
2007-07-17 05:23:26


On 17 Jul, 10:08, Matthew Peters <matthew.f.pet...googlemail.com>
wrote:
> Shame I didn't read it through carefully before posting
- that should
> be
> "that has *not* quite made it to the outside world
..."
>
> On Jul 17, 10:06 am, Matthew Peters
<matthew.f.pet...googlemail.com>
> wrote:
>
> > that has quite made it to the outside world. It
was mostly written by

+1 checking it into PECL cvs sounds like a good idea to me.

Simon


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: ATOMPUB binding
user name
2007-07-19 05:17:10
+1 from me too  .  I'd
like to progress this, and pecl seems like
the best place to do that.

On 17 Jul, 11:23, simonsl...googlemail.com wrote:
> On 17 Jul, 10:08, Matthew Peters
<matthew.f.pet...googlemail.com>
> wrote:
>
> > Shame I didn't read it through carefully before
posting - that should
> > be
> > "that has *not* quite made it to the outside
world ..."
>
> > On Jul 17, 10:06 am, Matthew Peters
<matthew.f.pet...googlemail.com>
> > wrote:
>
> > > that has quite made it to the outside world.
It was mostly written by
>
> +1 checking it into PECL cvs sounds like a good idea to
me.
>
> Simon


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: ATOMPUB binding
user name
2007-07-19 11:43:49
I ave check it into EIDER, along with its phpunit tests and
example (a
good starting point is
examples/SCA/atom/test_contact_feed.php). I
have also put up some rather cryptic notes at
http://groups.google.com/group/phpsoa/we
b/todo-list-for-the-atom-binding
- these are what I gathered when talking to Megan about it
(she wrote
it in the first place).


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: ATOMPUB binding
user name
2007-07-19 11:45:01
"I ave check" - what has happened to me  Mental
note - read the
post through before clicking on Send.

On Jul 19, 5:43 pm, Matthew Peters <matthew.f.pet...googlemail.com>
wrote:
> I ave check it into EIDER, along with its phpunit tests
and example (a
> good starting point is
examples/SCA/atom/test_contact_feed.php). I
> have also put up some rather cryptic notes athttp://groups.google.com/group/phpsoa/we
b/todo-list-for-the-atom-binding
> - these are what I gathered when talking to Megan about
it (she wrote
> it in the first place).


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Experiences with the ATOMPUB binding
user name
2007-08-13 12:29:50
Matthew Peters wrote:

> If anyone has an application where they would really
like such a
> thing, but does not mind if progress is a little slow,
I'd be glad to
> hear from them. Also, if anyone is excited by the idea
of taking a
> look at it and making it better I'd like to hear from
them too!

I had a go with the Atom binding a few days ago, to try to
implement a 
quick solution to a challenge from a colleague - results may
appear as 
an article sometime in the future. I'm sorry to say I gave
up after a 
while and instead provided a solution using CURL and
XMLWriter :-(

The nature of the problem was to create a new feed entry
with specified 
content, in a particular format, using Atom. So I needed, in
my SCA 
client, to create the xml for the entry, and POST it to the
non-SCA server.

I do realise that the Atom binding is experimental, and
indeed that some 
of the problems may be my mistakes - here follows a list of
the issues I 
encountered.

1. The examples led me astray
Like all lazy programmers, I started out trying to hack the
example 
code. This told me that it was not possible to use
SCA:getService() with 
Atom services. For example, ContactFeedConsumer starts out:
/**
* A component which consumes a contact atom feed service.
This is
* currently required because of the lack of support for
* SCA::getService() for atom services.

and continues:
/**
* A reference to the contact feed service. The Atom xsd is
currently
* required to be specified, but my abe optional in the
future.
*
* reference
* binding.atom ht
tp://localhost/examples/SCA/Atom/ContactFeed.php
* types http://www.w3.org/2005/At
om Atom1.0.xsd
*/

  Now, I later learnt that getService >does< work, if
I specify the 
binding type as the second parameter, but I didn't know that
at first, 
so tried to create a local service similar to
ContactFeedConsumer. The 
problem was that I couldn't find a way to specify a path to
the 
Atom1.0.xsd file in the SCA/Bindings/atom directory, and
ended up having 
to copy it into my client directory. Apparently the types is
no longer 
necessary either. Good news, but without updating the
examples, other 
people are likely to be confused, too.

2. The Atom Proxy didn't honour http 301 status code
I assumed this was an oversight, since other SCA proxies
which make use 
of cURL do have CURLOPT_FOLLOWLOCATION, so I updated the
code, after 
discussion with Graham. However I did subsequently (I know!)
read the 
relevant RFC which suggested that the automated redirect
should only be 
used for GETs. So if the omission was deliberate, I
apologise.

3.The Atom Proxy doesn't support common HTTP headers
No surprises here, this is a known problem common to all the
SCA proxies 
which use cURL. For the server I was using, I needed to add
   CURLOPT_HTTPAUTH => CURLAUTH_BASIC
   CURLOPT_USERPWD => "$user:$passwd"
   CURLOPT_SSL_VERIFYPEER => false
(though I should have used a more secure solution to the
last of those). 
We've talked before about needing some sort of configuration
side file 
to let SCA work in the real web world. I hacked my local
copy to get 
round this for now.

4.The Atom Proxy ended catastrophically on failure
I managed to break the proxy in various ways, with PHP Fatal
errors 
resulting from failed requests where the failure conditions
were not 
guarded. The two significant omissions were not checking
that the result 
  was not null before passing it to _fromXML(), and not
checking the 
cURL errno before attempting to process the status code and
the result, 
which  were uninitialised. It would be nice if these
conditions were 
returned as exceptions.

5.Server rejected the generated XML
I use the following code to generate my feed entry:

$xmldas = SDO_DAS_XML::create("Atom1.0.xsd");
$document = $xmldas->createDocument(
     "http://www.w3.org/2
005/Atom", 'entry');
$entry = $document->getRootDataObject();

/* Fill in the entry here */

return $xmldas->saveString($document);

and got xml data looking like this:

<?xml version="1.0"
encoding="UTF-8"?>
<tns:entry
    xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
    xmlns:tns="http://www.w3.o
rg/2005/Atom">
  <author>
   <name>Caroline Maynard</name>
  </author>
  ...
</tns:entry>

the server barfed on this, with status code 400 and message
"Unable to 
parse atom post entry". No doubt someone who knows
namespaces better 
than I do will correct me, but isn't that wrong, because
<author> and so 
on belong to the Atom namespace?

Anyway, even if technically correct, this particular server
didn't like 
it. A hand-cranked version:

<?xml version="1.0"
encoding="UTF-8"?>
<entry xmlns="http://www.w3.o
rg/2005/Atom">
  <author>
   <name>Caroline Maynard</name>
  </author>
  ... identical content here
</entry>

was consumed OK at the server.

Sorry that went on a bit. Comments?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #5
user name
2007-08-15 06:59:56
Caroline Maynard wrote:

> 5.Server rejected the generated XML
> I use the following code to generate my feed entry:
> 
> $xmldas =
SDO_DAS_XML::create("Atom1.0.xsd");
> $document = $xmldas->createDocument(
>      "http://www.w3.org/2
005/Atom", 'entry');
> $entry = $document->getRootDataObject();
> 
> /* Fill in the entry here */
> 
> return $xmldas->saveString($document);
> 
> and got xml data looking like this:
> 
> <?xml version="1.0"
encoding="UTF-8"?>
> <tns:entry
>     xmlnssi=&q
uot;http:
//www.w3.org/2001/XMLSchema-instance"
>     xmlns:tns="http://www.w3.o
rg/2005/Atom">
>   <author>
>    <name>Caroline Maynard</name>
>   </author>
>   ...
> </tns:entry>
> 
> the server barfed on this, with status code 400 and
message "Unable to 
> parse atom post entry". No doubt someone who knows
namespaces better 
> than I do will correct me, but isn't that wrong,
because <author> and so 
> on belong to the Atom namespace?
> 
> Anyway, even if technically correct, this particular
server didn't like 
> it. A hand-cranked version:
> 
> <?xml version="1.0"
encoding="UTF-8"?>
> <entry xmlns="http://www.w3.o
rg/2005/Atom">
>   <author>
>    <name>Caroline Maynard</name>
>   </author>
>   ... identical content here
> </entry>
> 
> was consumed OK at the server.

Do you think this is likely to be fall-out from the fix for

htt
p://issues.apache.org/jira/browse/TUSCANY-1112 ?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #2
user name
2007-08-15 08:39:43
Caroline Maynard wrote:

> For the server I was using, I needed to add
>    CURLOPT_HTTPAUTH => CURLAUTH_BASIC
>    CURLOPT_USERPWD => "$user:$passwd"
>    CURLOPT_SSL_VERIFYPEER => false
> (though I should have used a more secure solution to
the last of those). 

For the record, I did subsequently demonstrate that I could
make this 
work by removing the setting above which turns off
SSL_VERIFYPEER, and 
instead setting :
   CURLOPT_CAINFO => /path/to/my/cacert.pem

so that it checked the certificate rather than ignoring it.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Experiences with the ATOMPUB binding #2
user name
2007-08-15 15:19:42
Hi Caroline,

Thanks for your feedback on your experiences with the Atom
binding.
Doesn't make good reading, but it's very helpful.  I'm not
able to
work on this for the next couple of weeks, but hope to get
time to
work on SCA the week after.  Atom was going to be one of the
things I
wanted to look at  .


Graham.

On 15 Aug, 14:39, Caroline Maynard <c...php.net> wrote:
> Caroline Maynard wrote:
> > For the server I was using, I needed to add
> >    CURLOPT_HTTPAUTH => CURLAUTH_BASIC
> >    CURLOPT_USERPWD =>
"$user:$passwd"
> >    CURLOPT_SSL_VERIFYPEER => false
> > (though I should have used a more secure solution
to the last of those).
>
> For the record, I did subsequently demonstrate that I
could make this
> work by removing the setting above which turns off
SSL_VERIFYPEER, and
> instead setting :
>    CURLOPT_CAINFO => /path/to/my/cacert.pem
>
> so that it checked the certificate rather than ignoring
it.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "phpsoa" group.
To post to this group, send email to phpsoagooglegroups.com
To unsubscribe from this group, send email to
phpsoa-unsubscribegooglegroups.com
For more options, visit this group at http://
groups.google.co.uk/group/phpsoa?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-10] [11-20] [21-23]

about | contact  Other archives ( Real Estate discussion Medical topics )