skolodyazhnyy / symfony-rpc-bundle

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

XmlRpc\Implementation now can suppress schema validation #2

Closed graywolf closed 11 years ago

graywolf commented 11 years ago

I need this functionality, it would be nice to have it upstream (and therefore accessible via composer).

Default behaviour is not changed, so it should not brake anything.

graywolf commented 11 years ago

Any reason not to merge this?

skolodyazhnyy commented 11 years ago

Hi Tomas, Sorry, unable to review your request right now. I will surely do it asap.

Thanks for interest and contribution

skolodyazhnyy commented 11 years ago

Hi Tomas, What kind of problem do you have with schema validation? The schema should guaranty that code which extract parameters and method name will work.

I don't see any reason to add validateSchema parameter. If you have a project specific problem you can implement your own Implementation of RPC and inherit it from XML RPC implementation. Then override method which do validation with anything you need.

graywolf commented 11 years ago

Well, one of services in our company send invalid data (date is not in ISO 8601) and there's to much historical baggage to fix it. Sole reason for pushing this is to have this installable via composer. Since this is backward compatible change, I did not see reason why not to merge it.

It adds little more flexibility to this library..

skolodyazhnyy commented 11 years ago

Hi Tomas, You should agree that your problem is quite specific for your project. Your fix is backward compatible, but It extend library with non common case of usage. According to XML RPC standard all dates should be specified using ISO 8601.

I recommend you, create your own implementation of XMLRPC and make it use your own validation callback or XML schema. Then you can easily create a RPC Client and use your own implementation of RPC protocol, like this:

$impl = new Project\MyRpcBundle\XmlRpc\ImplementationWithoutXmlValidation();
$client = new Seven\RpcBundle\Rpc\Client("mywebserviceurl", $impl);
...

The ImplementationWithoutXmlValidation class should extend Seven\RpcBundle\XmlRpc\Implementation and it should override method Implementation::validateXml($document, $rootNodeName = null) with anything you want, even with return true. Or rewrite method Implementation::getSchema() to make it use your own XSD file.

Thanks for your interest