我在我的www.url.com/test.php?wsdl中有我的wsdl
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://dev1.locoprice.tourism-it.com/test.php?wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" targetNamespace="http://dev1.locoprice.tourism-it.com/test.php?wsdl">
<types>
<xsd:schema targetNamespace="http://dev1.locoprice.tourism-it.com/test.php?wsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</types>
<message name="helloRequest" />
<message name="helloResponse" />
<portType name="testPortType">
<operation name="hello">
<input message="tns:helloRequest" />
<output message="tns:helloResponse" />
</operation>
</portType>
<binding name="testBinding" type="tns:testPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="hello">
<soap:operation soapAction="http://dev1.locoprice.tourism-it.com/test.php/hello" style="rpc" />
<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>
<service name="test">
<port name="testPort" binding="tns:testBinding">
<soap:address location="http://dev1.locoprice.tourism-it.com/test.php" />
</port>
</service>
</definitions>
我只是有一个名为“ hello”的简单方法,它带有一个没有参数的简单“ return” hello”。.....如此简单..
当我将我的nusoap_client与getProxyClassCode一起使用时,我会得到以下结果:
string(234)“类nusoap_proxy_1384609830扩展了nusoap_client {// 无效函数hello(){$ params = array();返回$ this-> call('hello', $ params,'http://testuri.com', 'http://url/test.php/hello'); }}“
当我使用 $ client-> call('hello',array())); 我有一个“布尔(假)”,没有错误……
你能帮我吗? 谢谢你!
更多信息: 我的服务器:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once('nusoap/lib/nusoap.php');
try {
$URL = "http://url/test.php";
$namespace = $URL . '?wsdl';
//using soap_server to create server object
$server = new soap_server;
$server->configureWSDL('test', $namespace);
//register a function that works on server
$server->register('hello');
$server->service(file_get_contents("php://input"));
} catch (Exception $e) {
echo $e->getMessage();
}catch (Throwable $e) {
echo $e->getMessage();
}catch (SoapFault $e) {
echo $e->getMessage();
}catch (ContextErrorException $e){
echo $e->getMessage();
}
function hello()
{
return "hi";
}