note 96656 deleted from soapclient.soapcall by danbrown
| From: | danbrown@php.net | Date: | Wed, 10 Mar 2010 18:03:19 +0000 |
| Subject: | note 96656 deleted from soapclient.soapcall by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-166873@lists.php.net to get a copy of this message | ||
Note Submitter: gopheralex
----
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);
?>