简体   繁体   English

通过XML-RPC通过PHP前端与.NET / Java后端之间的交互:性能注意事项

[英]Interaction between PHP front-end and .NET/Java backend though XML-RPC: performances consideration

I'm implemented a solution which is constituted by a .NET back-end application based on ASP.NET: since the team that I'm considering to build should be composed of me and one or two front-end developers working in PHP. 我实现了一个解决方案,该解决方案由基于ASP.NET的.NET后端应用程序构成:由于我要建立的团队应该由我和一个或两个使用PHP的前端开发人员组成。

A good side effect of this architecture is that PHP is a fast server-side scripting engine which require less resources than ASP.NET. 此体系结构的一个很好的副作用是PHP是一种快速的服务器端脚本引擎,与ASP.NET相比,它需要的资源更少。

The only solution i've found for allowing the two layers to communicate is through XML-RPC, which is a protocol supported by both the systems (although the back-end part was implemented by me). 我发现允许两层通信的唯一解决方案是通过XML-RPC,这是两个系统都支持的协议(尽管后端部分是由我实现的)。 One problem of this approach is that XML-RPC doesn't support any authentication system and has some lack of performances in the serialization/deserialization between the object notation and the XML representation. 这种方法的一个问题是XML-RPC不支持任何身份验证系统,并且在对象表示法和XML表示之间的序列化/反序列化方面缺乏性能。

Has anyone any consideration or alternative solution? 有没有人考虑或替代解决方案?

You could play with the idea of using JSON if your application could allow it. 如果您的应用程序允许的话,您可以考虑使用JSON的想法。 JSON = Javascript Object Notation. JSON = Javascript对象符号。 It's a very lightweight syntax for describing objects. 这是用于描述对象的非常轻量级的语法。 I just used it to transfer data from a php server to clientside javascript through ajax requests in a project I just completed. 我只是用它通过刚刚完成的项目中的ajax请求将数据从php服务器传输到客户端javascript。 It takes a bit of getting used to, however you may find it easier to work with once you figure it all out. 这需要一点时间来适应,但是一旦您弄清了一切,您可能会发现使用它更容易。

I would agree that JSON may be an excellent approach for passing data, but to go from PHP to .NET you may want to use xml only because then you can use XML LINQ, which may make parsing simpler. 我同意JSON可能是传递数据的一种很好的方法,但是从PHP到.NET,您可能只想使用xml,因为这样便可以使用XML LINQ,这可能使解析变得更简单。

You can then communicate back and forth via http connections or webservices, depending on which way data flows, but I expect that it will flow from PHP -> .NET, so you could experiment with WCF to pass data, using a REST architecture, though PHP can do webservice client calls also. 然后,您可以通过http连接或Web服务来回通信,具体取决于数据流的方式,但是我希望它会从PHP-> .NET流出,因此您可以尝试使用REST体系结构使用WCF来传递数据。 PHP也可以执行Web服务客户端调用。

If you communicate back from the .NET with JSON or use a webservice response then you have a good decoupling between the two frameworks. 如果您使用JSON从.NET通讯回来或使用Web服务响应,则这两个框架之间将保持良好的脱钩状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM