Problem webservice consume for client
Hi,
I'm doing a test, but I have a problem. I'm did a server with WSO2 framework for php using WSDL API generation. The source of the server is:
/**
* class student
* @namespace http://test
*/
class Student
{
/**
* @property string id
* (maps to the xs:string XML schema type )
*/
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
/**
* @return array of object Student $a
* (maps to the xs:anyType XML schema type )
*/
function getStudents()
{
$a = array();
for($i = 0; $i <= 2; $i++)
{
$a[$i] = new Student("$i");
}
return $a;
}
$operations = array("getStudents");
$service = new WSService(array("operations" => $operations));
$service->reply();
The wsdl output is ok, that is:
−
<definitions targetNamespace="http://www.wso2.org/php">
−
<types>
−
<xsd:schema elementFormDefault="qualified" targetNamespace="http://www.wso2.org/php">
−
<xsd:element name="getStudentsResponse">
−
<xsd:complexType>
−
<xsd:sequence>
<xsd:element name="a" maxOccurs="unbounded" type="ns0:Student"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
−
<xsd:schema elementFormDefault="qualified" targetNamespace="http://test">
−
<xsd:complexType name="Student">
−
<xsd:sequence>
<xsd:element name="id" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
−
<message name="getStudents">
<part name="parameters" element="tns:getStudents"/>
</message>
−
<message name="getStudentsResponse">
<part name="parameters" element="tns:getStudentsResponse"/>
</message>
−
<portType name="~fabio_wso2service_service.phpPortType">
−
<operation name="getStudents">
<input message="tns:getStudents"/>
<output message="tns:getStudentsResponse"/>
</operation>
</portType>
−
<binding name="~fabio_wso2service_service.phpSOAPBinding" type="tns:~fabio_wso2service_service.phpPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
−
<operation name="getStudents">
<soap:operation soapAction="http://200.17.41.239/~fabio/wso2service/service.php/getStudents" style="document"/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
−
<service name="~fabio_wso2service_service.php">
−
<port name="~fabio_wso2service_service.phpSOAPPort_Http" binding="tns:~fabio_wso2service_service.phpSOAPBinding">
<soap:address location="http://localhost/~fabio/wso2service/service.php"/>
</port>
</service>
</definitions>
When I use the webservice in client, a error message is displayed.
The source of client is:
class Student {
public $id; // string
}
// define the class map
$class_map = array("Student" => "Student");
$client = new WSClient(array ("wsdl" =>"http://localhost/~fabio/wso2service/service.php?wsdl",
"classmap" => $class_map));
$proxy = $client->getProxy();
$response = $proxy->getStudents();
When the $proxy->getStudents() method is called the mensage error is displayed:
Fatal error: Uncaught exception 'DOMException' with message 'Namespace Error' in /usr/lib/php5/20060613+lfs/wsf_php/scripts/dynamic_invocation/wsf_wsdl_client_request.php:186 Stack trace: #0 /usr/lib/php5/20060613+lfs/wsf_php/scripts/dynamic_invocation/wsf_wsdl_client_request.php(186): DOMDocument->createElementNS(NULL, 'ns1:getStudents') #1 wsf_wsdl.php(156): wsf_create_payload(Object(DOMElement), true, 'getStudents', 0, Array, Array) #2 [internal function]: wsf_process_wsdl(Array, Array) #3 [internal function]: WSClientProxy->__call('getStudents', Array) #4 /home/fabio/workspace/wso2service/client.php(16): WSClientProxy->getStudents() #5 {main} thrown in /usr/lib/php5/20060613+lfs/wsf_php/scripts/dynamic_invocation/wsf_wsdl_client_request.php on line 186
I tried everything to find out the cause of the problem, but not succeeded.
Someone help me?
Sorry my poor english
- Login or register to post comments
- Printer friendly version
- 22 reads






















Hi faborm, This bug is there
Hi faborm,
This bug is there in the wsf/php 1.2.1 release, that it is not working when you don't provide any input parameters. WSF/PHP 1.3 release will be avilable soon. please use that.. I have attached the corrected service.php that worked with the latest svn. Note that you should provide the "opParams" option to the WSService. and from 1.3 release the annotation for a class varible should be declared as @var instead of @property.
Thanks
Dimuthu