skolodyazhnyy / symfony-rpc-bundle

Simple JSON and XML RPC Server/Client implementation for Symfony 2
MIT License
25 stars 22 forks source link

Documentation #3

Closed skonsoft closed 10 years ago

skonsoft commented 10 years ago

Hello,

Can you write some documentation to know how to use your bundle as client of an xml rpc server ?

regards

skolodyazhnyy commented 10 years ago

Hi,

Sure, I will. In general it's quite easy, there is an example:

 $client = new \Seven\RpcBundle\XmlRpc\Client('http://xml.rpc.server/endpoint.php');
 $result = $client->call('method_name', array($parameter1, $parameter2, ..));

In case of error you will get an Exception.

firomero commented 10 years ago

Thanks a lot for your explanation, but i've another quest, how can i know if the server is down?. What execption should i receive.

skolodyazhnyy commented 10 years ago

In current version you will get an exception if you will try to call unreachable server. But this exception will not reflect the problem it will say "Empty response".

firomero commented 10 years ago

Using the client i get this: The XML document has not valid XML-RPC content is an error from the server or my own?

chigwicheung commented 10 years ago

I have a requirement that create a python RPCserver and client using php. But Notice: Undefined property: DOMText::$tagName in /home/wwwroot/sample/vendor/seven/symfony-rpc-bundle/Seven/RpcBundle/XmlRpc/Implementation.php Finally, I changed the Implementation.php which function's name createMethodResponse from $xpath->query("//methodResponse/params/param"); to $xpath->query("//methodResponse/params/param/value"), and it is resolved. Btw,I use Silex Framework, below is my composer "require": { "silex/silex": "~1.1", "symfony/twig-bridge": "~2.4", "twig/twig": ">=1.8,<2.0-dev", "mheap/Silex-Assetic": "", "natxet/cssmin": "@dev", "symfony/yaml": "~2.3", "seven/symfony-rpc-bundle": "dev-master" } Thx for your hard work.

skolodyazhnyy commented 10 years ago

@chigwicheung thanks for letting me know. I have made a fix few moments ago.