nusoap problem with soapval objects in soapclient->call()
| From: | Jon Goodwin | Date: | Sat, 03 Jan 2004 15:19:24 +0000 |
| Subject: | nusoap problem with soapval objects in soapclient->call() | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1281@lists.php.net to get a copy of this message | ||
Hi,
I am using nusoap version 0.6.5 with PHP 4.2.2 on Windows NT 5.0 and Apache
2.0.39.
I create a couple of soapval objects, put them in an array and use the
soapclient->call() method to pass them to my function in my server class.
When the server function is executed, I am only able to access the first
object. See code sample and output below.
I think that the problem lies with the call in nusoap.php on line 2392:
$method_response = call_user_func_array("$this->methodname",$request_data);
I have two soapval objects in $request_data, but only one is passed in my
function in my server class.
I have posted a question on this (related?) problem to:
http://news.php.net/article.php?group=php.general&article=173681
Below is my source and the output. I have two files: server.php and
client.php.
Thanks in advance.
Regards
Jon Goodwin
<?php
// server.php
require_once("nusoap.php"); // 0.6.5
$s = new soap_server;
$s->register('f');
function f($params)
{
return "Count=:" . count($params);
}
$s->service($HTTP_RAW_POST_DATA);
?>
<?php
// client.php
require_once("nusoap.php"); // 0.6.5
$soapclient = new soapclient('http://localhost/tmp/server.php');
$sv1 = new soapval('A_STRING', 'string', "Hello");
$sv2 = new soapval('A_NUMBER', 'integer', 123456789);
$parameters = array($sv1, $sv2);
echo($soapclient->call('f', $parameters));
echo("<h3>Request</h3><xmp>" . $soapclient->request .
"</xmp>");
echo("<h3>Response</h3><xmp>" . $soapclient->response .
"</xmp>");
?>
OUTPUT >>>
Count=:1
Request
POST /tmp/server.php HTTP/1.0
User-Agent: NuSOAP/0.6.3
Host: localhost
Content-Type: text/xml; charset=ISO-8859-1
Content-Length: 589
SOAPAction: ""
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:si="http://soapinterop.org/xsd"><SOAP-ENV:Body><ns1:f
xmlns:ns1="http://testuri.org">
<A_STRING xsi:type="xsd:string">Hello</A_STRING><A_NUMBER
xsi:type="xsd:integer">123456789</A_NUMBER></ns1:f>
</SOAP-ENV:Body></SOAP-ENV:Envelope>Response
HTTP/1.1 200 OK
Date: Sat, 03 Jan 2004 14:06:14 GMT
Server: NuSOAP Server v0.6.3
Accept-Ranges: bytes
X-Powered-By: PHP/4.2.2
Status: 200 OK
Connection: Close
Content-Length: 1887
Content-Type: text/xml; charset=UTF-8
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:si="http://soapinterop.org/xsd"><SOAP-ENV:Body><fResponse><soapVal
xsi:type="xsd:string">Count=:1</soapVal></fResponse></SOAP-ENV:Body></SOAP-E
NV:Envelope><!--
soap_server: entering parseRequest() on 14:06 2004-01-03
soap_server: User-Agent: NuSOAP/0.6.3
soap_server: Host: localhost
soap_server: Content-Type: text/xml; charset=ISO-8859-1
soap_server: Content-Length: 589
soap_server: SOAPAction: ""
soap_server: got encoding: UTF-8
soap_server: method name: f
soap_server: method 'f' exists
soap_server: calling parser->get_response()
soap_server: parser debug:
soap_parser: Entering soap_parser()
soap_parser: found root struct f, pos 2
soap_parser: adding data for scalar value A_STRING of value Hello
soap_parser: adding data for scalar value A_NUMBER of value 123456789
soap_parser: inside buildVal() for f(pos 2) of type struct
soap_parser: parsed successfully, found root struct: 2 of name f
soap_server: params var dump array(2) {
["A_STRING"]=>
&string(5) "Hello"
["A_NUMBER"]=>
&int(123456789)
}
soap_server: calling 'f' with params
soap_server: calling method using call_user_func_array()
soap_server: response var dumpstring(8) "Count=:1"
soap_server: done calling method: f, received Count=:1 of typestring
soap_server: got a(n) string from method
soap_server: serializing return value
soap_server: in serialize_val: Count=:1, , , , , , encoded
soap_server: return val:string(49) "<soapVal
xsi:type="xsd:string">Count=:1</soapVal>"
soap_server: serializing response
soap_server: server sending...
-->