简体   繁体   English

PHP中的SOAP服务器 - 如何编写WSDL文件 - 提示

[英]SOAP Server in PHP - how to write WSDL file - tips

I have quite complex (authentication, logs, ...) SOAP server (standard PHP extension). 我有相当复杂的(身份验证,日志,...) SOAP服务器 (标准PHP扩展)。 Everything is working fine but I want to know if there is any tool for creating / generating WSDL file? 一切都运行正常,但我想知道是否有任何工具来创建/生成WSDL文件? All changes I do manually and there are two problems: 我手动做的所有更改都存在两个问题:

  1. localhost 本地主机

I have for testing reasons the same SOAP server on localhost - I need the same WSDL file and only difference is in url addresses which point to localhost. 我出于测试原因在localhost上使用相同的SOAP服务器 - 我需要相同的WSDL文件,唯一的区别在于指向localhost的url地址。 I copy & paste lines from one (localhost) file to other (production) file and this is good way to do mistake. 我将行(localhost)文件中的行复制并粘贴到其他(生产)文件中,这是做错的好方法。

  1. new function When I want to add function to WSDL it takes me "long" time to understand again wsdl because it has more that 1000 lines. 新函数当我想向WSDL添加函数时,我需要“很长时间”再次理解wsdl,因为它有超过1000行。

I'm quite new to SOAP and also WSDL - I'm looking for good (and free) WSDL editor or tool to gererate WSDL file. 我是SOAP和WSDL的新手 - 我正在寻找好的(和免费的)WSDL编辑器或工具来创建WSDL文件。

Creating WSDL file from scratch can be very complicated and error prone. 从头开始创建WSDL文件可能非常复杂且容易出错。 To ease this process, you can use an IDE to generate the WSDL file for your PHP functions and pass it as a parameter to your PHP SoapServer class. 为了简化此过程,您可以使用IDE为PHP函数生成WSDL文件,并将其作为参数传递给PHP SoapServer类。 Check out this simple tutorial on How to generate wsdl for php native soap class 看看这个关于如何为php native soap class生成wsdl的简单教程

Try WSO2 WSF/PHP Library . 尝试WSO2 WSF / PHP库 It can generate WSDL right from your code. 它可以直接从您的代码生成WSDL。

If you're using Eclipse, you can take a look into the WSDL Editor . 如果您正在使用Eclipse,则可以查看WSDL编辑器

You can also create a build script, that parses an existing WSDL (it's XML) and replace specific values (like the hostname) with another one to a target file. 您还可以创建一个构建脚本,该脚本解析现有的WSDL(它的XML)并将特定值(如主机名)替换为另一个目标文件。

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

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