Hey @ll,
I trying beginning of the week my first Webservices with the help of "nusoap".
It also works parts.
I let me automatically from a php (class_soap.php) file is a WSDL file generate:
//class_soap.php
class ClearingZone{
/**
* Adds two numbers
*
* @param float $p1
* @param float $p2
* @return float
*/
public function addiere($p1, $p2) {
return ($p1+$p2);
}
}
|
works wonderfully my WSDL looks like this:
<definitions name="ClearingZone" targetNamespace="urn:ClearingZone">
−
<message name="addiere">
<part name="p1" type="xsd:float"/>
<part name="p2" type="xsd:float"/>
</message>
−
<message name="addiereResponse">
<part name="addiereReturn" type="xsd:float"/>
</message>
−
<portType name="ClearingZonePortType">
−
<operation name="addiere">
<documentation>Adds two numbers</documentation>
<input message="typens:addiere"/>
<output message="typens:addiereResponse"/>
</operation>
</portType>
−
<binding name="ClearingZoneBinding" type="typens:ClearingZonePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="addiere">
<soap:operation soapAction="urn:ClearingZoneAction"/>
−
<input>
<soap:body namespace="urn:ClearingZone" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
−
<output>
<soap:body namespace="urn:ClearingZone" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
−
<service name="ClearingZoneService">
−
<port name="ClearingZonePort" binding="typens:ClearingZoneBinding">
<soap:address location="http://wiese-dev/webservices/server/index.php"/>
</port>
</service>
</definitions>
|
the server then I start with (server.php):
//server.php
include('../nusoap/lib/nusoap.php');
$wsdl_path = "wsdl/ClearingZone.wsdl";
$server = new soap_server($wsdl_path);
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
|
and so do I start the client:
//client.php
include('../nusoap/lib/nusoap.php');
$client = "http://wiese-dev/webservices/server/index.php?wsdl";
$client = new nusoap_client($client, true);
$result = $client->call('addiere', array('p1' => '45', 'p2' => '45'));
|
but I receive the following error msg:
Array
(
[faultcode] => SOAP-ENV:Client
[faultactor] =>
[faultstring] => method 'addiere' not defined in service
[detail] =>
)
|
when I at the function (addiere) directly to the work "server.php" then it works.
I want the function and the classe from the "class_soap.php" is called.
does that mean?
About your help I would be very happy
many greetings
Ben