NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
phpNusoap client -> php5 Server


Joined: 20 Jul 2009
Posts: 1
Location: Girona (Catalonia)
Reply with quote
Hello! Smile

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 Sad I paste the code, someone can help me?

Server | WSDL

Code:

<?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

Code:

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)

Code:

$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)

Code:

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;     
}
View user's profileFind all posts by DimasSend private message
phpNusoap client -> php5 Server
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic