note 96656 added to soapclient.soapcall
| From: | gopheralex at osu1 dot php dot net | Date: | Wed, 10 Mar 2010 02:11:26 +0000 |
| Subject: | note 96656 added to soapclient.soapcall | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166855@lists.php.net to get a copy of this message | ||
Just to re-emphasize what Shto was saying:
__soapCall() (like SOAP itself) is very particular about the exact structure of the request. In
trying to interface with a JAX-WS web service, I tried a lot of different combinations, some
involving the SoapVar and SoapParam classes and some not. My problem was that the parameters I was
passing in PHP kept coming in null on the server. I finally figured out how to fix it.
Example with two integer parameters:
<?php
$params = array(
"parameters" => array(
"num1" => 5,
"num2" => 6
)
);
$result = $sc->__soapCall("addNumbers", $params);
?>
"num1" and "num2" must match the names of the parameters of the addNumbers()
method on the server - it's not enough to just pass the same number of parameters.
Another example with an object parameter; in this case the remote doSomethingWithACircle() method
expects a parameter called "circle", of type Circle, so it is necessary to first define a
compatible Circle class locally:
<?php
class Circle {
public $radius;
public $color;
}
$c = new Circle();
$c->radius = 5;
$c->color = "orange";
$params = array(
"parameters" => array(
"circle" => $c
)
);
$sc->__soapCall('doSomethingWithACircle', $params);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 70.170.28.188
----
Manual Page -- http://www.php.net/manual/en/soapclient.soapcall.php
Edit -- https://master.php.net/note/edit/96656
Del: integrated -- https://master.php.net/note/delete/96656/integrated
Del: useless -- https://master.php.net/note/delete/96656/useless
Del: bad code -- https://master.php.net/note/delete/96656/bad+code
Del: spam -- https://master.php.net/note/delete/96656/spam
Del: non-english -- https://master.php.net/note/delete/96656/non-english
Del: in docs -- https://master.php.net/note/delete/96656/in+docs
Del: other reasons-- https://master.php.net/note/delete/96656
Reject -- https://master.php.net/note/reject/96656
Search -- https://master.php.net/manage/user-notes.php