检查基于PHP的SOAP服务器是否工作正常
我有一个SOAP服务器问题,这几天我都快发疯了。我有一个非常简单的SOAP客户端PHP脚本,同时询问一个简单的SOAP服务器PHP脚本 我在调试服务器上有这些脚本的精确副本,它们工作得很好(这只是一个hello World函数),但在生产环境中,似乎无法从soap客户端获得soap服务器的响应。我不断收到“过程”ns1:testHello“不存在”错误(testHello是函数名) 我知道生产客户机正在工作,因为若我从生产服务器调用来开发WSDL,那个么它就可以完美地工作。我确实认为它在某种程度上与SOAP服务器相关,但我如何才能确切地知道它是否工作正常以及出了什么问题 如果查看infophp()转储,我会发现SOAP服务器和客户端都已启用检查基于PHP的SOAP服务器是否工作正常,php,soap,wsdl,soapserver,Php,Soap,Wsdl,Soapserver,我有一个SOAP服务器问题,这几天我都快发疯了。我有一个非常简单的SOAP客户端PHP脚本,同时询问一个简单的SOAP服务器PHP脚本 我在调试服务器上有这些脚本的精确副本,它们工作得很好(这只是一个hello World函数),但在生产环境中,似乎无法从soap客户端获得soap服务器的响应。我不断收到“过程”ns1:testHello“不存在”错误(testHello是函数名) 我知道生产客户机正在工作,因为若我从生产服务器调用来开发WSDL,那个么它就可以完美地工作。我确实认为它在某种程度
Soap Client enabled
Soap Server enabled
Directive Local Value Master Value
soap.wsdl_cache 1 1
soap.wsdl_cache_dir /tmp /tmp
soap.wsdl_cache_enabled 0 1
soap.wsdl_cache_limit 5 5
soap.wsdl_cache_ttl 0 86400
我尝试强制使用SOAP_1_1和SOAP_1_2两个版本,但没有任何更改。
我尝试过禁用各种缓存,但也没有做任何更改。
我已经读到“ns:X函数不存在”通常是由于WSDL配置错误造成的,但是如果它是一个精确的副本(除了targetNamespace、xmlns:tns和指向生产服务器的soap:AddressURL之外),它怎么可能是错误的呢
我开始认为这与某些web服务器配置设置有某种关联。有什么想法吗?我可以做什么样的测试?
Thanx提前了很多时间
我的服务器代码:
ini_set("display_errors", "off");
ini_set("soap.wsdl_cache_enabled", 0);
ini_set('soap.wsdl_cache_ttl',0);
$wsdl_url="http://SITE_URL/test.wsdl";
function testHello($functionName){
$return = "Hello, ".$functionName;
return $return;
}
$server= new SoapServer($wsdl_url, array('cache_wsdl' => WSDL_CACHE_NONE));
$server->addFunction("testHello");
$server->handle();
我的客户代码
ini_set("soap.wsdl_cache_enabled", 0);
ini_set('soap.wsdl_cache_ttl',0);
ini_set("display_errors", "on");
$wsdl_url="http://SITE_URL/test.wsdl";
$client=new SoapClient($wsdl_url , array('cache_wsdl' => WSDL_CACHE_NONE));
try{
$t = $client-> testHello("Test");
var_dump($t);
} catch(SoapFault $e){
var_dump($e);
}
我的WSDL文件
<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="TLN"
targetNamespace="http://SITE_URL/test.wsdl"
xmlns:tns="http://SITE_URL/test.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="testHelloRequest">
<part name="functionName" type="xsd:string"/>
</message>
<message name="testHelloResponse">
<part name="return" type="xsd:string"/>
</message>
<portType name="testHelloPortType">
<operation name="testHello">
<input message="tns:testHelloRequest" />
<output message="tns:testHelloResponse" />
</operation>
</portType>
<binding name="testHelloBinding" type="tns:testHelloPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="testHello">
<soap:operation soapAction="" />
<input>
<soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body use="encoded" namespace="" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<documentation>testHello</documentation>
<service name="testHelloService">
<port name="testHelloPort" binding="testHelloBinding">
<soap:address location="http://SITE_URL/server.php" />
</port>
</service>
</definitions>
你好
当我创建一个soap服务器时,我通常用soapUI测试我的WSDL文件。用soapUI检查我的soap服务器对我来说太容易了,你可以试试它,我用过soapUI,使soap开发更容易。顺便说一句,这似乎是一个服务器配置问题,它正在试图解决这个问题。只是一个小的更新,以防其他人感兴趣。似乎生产服务器在本机SOAP库方面还有一个尚未解决的问题。安装了nusoap,然后完全工作。