Hello!
I've created a WS Linux server with php5 native libraries, and I tried it with a native php5 WS client and it works ok. Now I've to consume it with a Windows php 4.x server, so I've created a WS client using the phpNusoap library. There is no apparent error, but no parameters are arriving to the server
I paste the code, someone can help me?
Server | WSDL
<?xml version='1.0' encoding='UTF-8' ?>
<definitions name='FormularisCDR'
targetNamespace='urn:FormularisCDR'
xmlns:tns='urn:FormularisCDR'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<message name='novaPeticioAlergiaRequest'>
<part name='numcolegiat' type='xsd:string'/>
</message>
<message name='novaPeticioAlergiaResponse'>
<part name='Result' type='xsd:boolean'/>
</message>
<portType name='FormularisCDRPortType'>
<operation name='novaPeticioAlergia'>
<input message='tns:novaPeticioAlergiaRequest'/>
<output message='tns:novaPeticioAlergiaResponse'/>
</operation>
</portType>
<binding name='FormularisCDRBinding' type='tns:FormularisCDRPortType'>
<soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='novaPeticioAlergia'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#novaPeticioAlergia'/>
<input>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>
<service name='FormularisCDRService'>
<port name='FormularisCDRPort' binding='FormularisCDRBinding'>
<soap:address location='http://zeus.trueta.intranet/soap/formularisCDR/formularisCDR.php'/>
</port>
</service>
</definitions>
|
Server | Class
require 'formularisCDR_classe.php';
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$server = new SoapServer("http://zeus.trueta.intranet/soap/formularisCDR/formularisCDR.wsdl");
$server->setClass("formularisCDR_classe");
$server->handle();
class formularisCDR_classe {
function novaPeticioAlergia($numcolegiat) {
throw new SoapFault("Server",$numcolegiat); // $numcolegiat is empty with phpNusoap client
/*
code not working because $numcolegiat is empty with the phpNusoap client
*/
}
}
|
Client | phpNusoap (not working)
$client = new nusoap_client('http://zeus.trueta.intranet/soap/formularisCDR/formularisCDR.wsdl', 'wsdl');
$err = $client->getError();
if ($err)
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
$param = array('numcolegiat' => 'test');
$result = $client->call('novaPeticioAlergia', array($param));
|
Client | php5 (working)
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$client = new SoapClient("http://zeus.trueta.intranet/soap/formularisCDR/formularisCDR.wsdl");
try {
echo "<pre>\n";
$return = $client->novaPeticioAlergia("example");
echo utf8_decode($return);
echo "\n";
echo "\n</pre>\n";
}
catch (SoapFault $exception) {
echo $exception;
}
|