NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
nusoap extrerne classen/function


Joined: 07 Aug 2008
Posts: 1
Reply with quote
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:
Code:

//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:

Code:

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

Code:

//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:

Code:

//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:
Code:

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
View user's profileFind all posts by r1g0Send private message
nusoap extrerne classen/function
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