Forums / General / Web Service call from a template

Web Service call from a template

Author Message

Greg Lakomy

Tuesday 22 April 2008 7:55:47 pm

Is it possible?

I need to call a web sevice that returns XML data. Then, I need to parse it and spit it on a page.

What's the best way to do that?

Thanks,
Greg.

Developer
http://www.duoconsulting.com

Maxime Thomas

Tuesday 22 April 2008 11:32:32 pm

I guess the best is to use php-curl.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

Piotrek Karaƛ

Wednesday 23 April 2008 12:13:05 am

I'd probably write my own template operator that consumes the service (using PHP) and then returns either the XML object itself or some sort of formatted data structure that leaves template operations easy. If multiple web services, the operator could take a service address etc...

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Xavier Gouley

Wednesday 23 April 2008 3:50:24 am

Hi Greg, Hi Max :)

It is done on a web site today, at work.
I used php-soap for Web Service (not curl) :
works pretty well for very complex Web Services, but for simple request/reponse, php-curl should be better I guess.

I prefer a fetch than an operator, must easier to pass parameters (in the hash), and a little faster to execute.

Good luck !

Xavier Gouley
http://www.gxapplications.com/eng_blog/GX-Admin-s-Blog/