创建网络服务最佳实践?
目前我正在尝试创建一个网络服务,该服务应该成为第三方进入我的系统的入口点。阅读一些信息后,我开始创建我的测试服务。
起初,我从 PEAR 包开始,但我发现定义服务太麻烦(使用 __typedef 和 __dispatch_map),所以我进一步研究。我发现了我最初的资源,php 的本机 SoapServer。这看起来更清晰,因为函数区域很容易定义,但我需要定义 WSDL。这就是我陷入困境的地方。是否有一种简单的方法来创建 WSDL,告诉生成器哪些函数/方法可用、它们期望哪些参数以及返回值是什么?
Currently I'm experimenting on creating a webservice which should be the point of entry for third parties to my system. After reading some info I got started on creating my testservice.
At first I started with the PEAR package but I found it to be too much of a hassle to define the service (with the __typedef
and __dispatch_map
) so I looked further. I came across my initial resource, php's native SoapServer. This looks a lot cleaner because functions area easily defined but I need to define the WSDL. This is where I get stuck. Is there a simple way to create a WSDL by telling the generator which functions/methods are available, which parameters they expect and what the returnvalue is?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Slim 框架用于创建 RESTful Web 应用程序。 Slim 微型框架满足您所需的一切,没有您不需要的。
http://www.slimframework.com/
这是我在市场上找到的最好的一个。
Slim framework is used to create RESTful web applications. The Slim micro framework is everything you need and nothing you don't.
http://www.slimframework.com/
This is the best one i found in the market.
我发现 Zend Autodiscovery 在尝试避免创建 WSDL 文件所带来的所有麻烦时非常有用。 Zend 因用作框架而闻名,但如果您想维护独立应用程序,也可以将其用作库。请查看:
http://framework.zend.com/manual/ en/zend.soap.autodiscovery.html
话虽如此,实现 Web 服务的方法有很多,所以我建议您在选择 SOAP 之前先看看其他选项。我个人觉得REST很棒。
I found Zend Autodiscovery to be very helpful when trying to avoid all the hustle that come with creating WSDL files. Zend is famously used as a framework but you can also use it as a library if you want to maintain a standalone application. Check it out at:
http://framework.zend.com/manual/en/zend.soap.autodiscovery.html
Having said that, there are many ways to implement web services so I suggest you have a look at other options before settling on SOAP. I personally feel that REST is brilliant.
Nusoap PHP 工具(实际上是库)会自动为您生成 WSDL。
显然,您必须编写一些代码来向 Nusoap 解释数据的类型。它还处理自定义的复杂数据。
http://sourceforge.net/projects/nusoap/
它还附带了大量的示例...
The Nusoap PHP tool (actually, library), automatically generates the WSDL for you.
Obviously you have to write some code that explain to Nusoap what are the types of your data. It also handle custom, complex data.
http://sourceforge.net/projects/nusoap/
It also come with plentiful of examples...