开发者

how to make webservices in PHP that return data in XML?

开发者 https://www.devze.com 2023-03-10 09:37 出处:网络
how to make components to be added to alr开发者_StackOverfloweady existing Joomla based website so that they can return XML when another system, like a phone makes a web request.

how to make components to be added to alr开发者_StackOverfloweady existing Joomla based website so that they can return XML when another system, like a phone makes a web request.

The generated content should have information embedded in the form of XML.

i have seen this happen in several places and was wondering if i wanted to start to learn to do the above how should i do it?

Also how is it actually done?


This article pretty well sums it up entirely: http://sam.xnet.tk/post/15/php-soap-server-part-2/

Things to note:

  • You have to create/maintain the WSDL by hand, as is my understanding.
  • You have to not try and fight the framework. Just "return" as appropriate the data you want.
  • It should live outside the Joomla templates.
  • You should be using PHP5.

Example code from that article:

$classmap = array('Meeting'=>'Meeting');
$server = new SoapServer('soap.wsdl',array('classmap'=>$classmap));
$server->setClass("MySoapServer");
$server->handle();

class Meeting
{
    var $Location;
    var $Name;
    var $Importance;
    var $StartTime;
    var $Duration;
}

but really I suggest you read through all the code provided in that post example download.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号