How to generate a PHP soap client code?(如何生成PHPsoap客户端代码?)
问题描述
有没有办法从 WSDL 文件生成 PHP Soap 客户端?
Is there a way to generate a PHP Soap Client from a WSDL file?
我的意思是像 .net 中的 wsdl.exe 或 svcutil.exe 之类的东西,它为可以作为服务客户端的类生成代码,而不是像:
I mean something like wsdl.exe or svcutil.exe in .net, that generates code for a class that can be the client of a service, not something like:
$WSDL     = new SOAP_WSDL($wsdl_url); 
$client   = $WSDL->getProxy(); 
我的问题是我希望 PHP 客户端能够使用服务,即使该服务没有公开其 WSDL.
My problem is that I want the PHP client to be able the work with a service, even when that service doesn't expose its WSDL.
推荐答案
您可以使用 SOAP_WSDL (http://pear.php.net/reference/SOAP-0.9.4/SOAP/SOAP_WSDL.html#methodgenerateProxyCode) 方法,并将其保存到文件中:
You can use the method [generateProxyCode] provided in the package SOAP_WSDL (http://pear.php.net/reference/SOAP-0.9.4/SOAP/SOAP_WSDL.html#methodgenerateProxyCode) method instead and save it to a file:
$WSDL     = new SOAP_WSDL($wsdl_url); 
$php      = $WSDL->generateProxyCode();
file_put_contents('wsdl_proxy.php', '<?php ' . $php . ' ?>');
require 'wsdl_proxy.php';
                        这篇关于如何生成PHPsoap客户端代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何生成PHPsoap客户端代码?
				
        
 
            
        基础教程推荐
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
 - php 7.4 在写入变量中的 Twig 问题 2022-01-01
 - 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
 - php中的PDF导出 2022-01-01
 - 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
 - php中的foreach复选框POST 2021-01-01
 - PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
 - 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
 - Web 服务器如何处理请求? 2021-01-01
 - 将变量从树枝传递给 js 2022-01-01
 
    	
    	
    	
    	
    	
    	
    	
    	
				
				
				
				