Web service with several operations : only the first one works
| From: | LEBUR Guillaume | Date: | Wed, 08 Jun 2005 16:24:24 +0000 |
| Subject: | Web service with several operations : only the first one works | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1926@lists.php.net to get a copy of this message | ||
Hi,
I have a WSDL file that looks like this (desc.wsdl) :
[...]
<binding name="cmsserverBinding" type="tns:cmsserverPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getRubriques">
<documentation>Liste des rubriques du CMS</documentation>
<soap:operation soapAction="urn:cms#getRubriques" style="document"/>
<input><soap:body use="literal"
namespace="urn:cms"/></input>
<output><soap:body use="literal"
namespace="urn:cms"/></output>
</operation>
<operation name="getGroupes">
<documentation>Liste des groupes du CMS</documentation>
<soap:operation soapAction="urn:cms#getGroupes" style="document"/>
<input><soap:body use="literal"
namespace="urn:cms"/></input>
<output><soap:body use="literal"
namespace="urn:cms"/></output>
</operation>
</binding>
[...]
A SOAP server like this :
[...]
class cms {
function getRubriques()
{ [...]
}
function getGroupes()
{
[...] }
}
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$server = new SoapServer("desc.wsdl", array('uri' => 'urn:cms',
'encoding'=>SOAP_ENCODED ));
$server->SetClass('cms');
$server->handle();
And the SOAP client :
$client = new
SoapClient("http://localhost/cms_test/backend/webservice/desc.wsdl",
array("trace" => 1));
$funct= $client->__getFunctions(); // WORKS
echo $funct[0];
echo $funct[1];
$texte="uv";
//$result = $client->getRubriques($texte);
$result = $client->getGroupes($texte);
echo "result : ". $result; //DOESNT WORK
As you can see, there are two possible operations in that web service :
getRubriques and getGroupes.
When getGroupes comes first in the WSDL file and I call the getGroupes()
function in the client, it works perfectly (returning the right SOAP
response and everything).
When getRubriques comes first in the WSDL file and I call the
getRubriques() function in the client, it works perfectly, too.
The problem is, when I try to call the operation that comes second in
the WSDL file inside the <binding> element, I get no SOAP response from
the server. In fact, the function of the server is not called at all.
I've tried to swap the two operations but no way : when getGroupes is
second it doesn't work, and when getRubriques is second it doesn't work
either.
I must add that the SOAP client can perfectly tell what operations the
server provides (via __getFunctions() ).
Where would the error come from ? The WSDL file ? A bad option in the
server or the client ?
Thanks in advance for your help,
Guillaume