downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SoapVar> <SoapParam::__construct
[edit] Last updated: Fri, 10 Feb 2012

view this page in

SoapParam::SoapParam

(PHP 5 >= 5.0.1)

SoapParam::SoapParamConstructeur SoapParam

Description

SoapParam::SoapParam ( mixed $data , string $name )

Construit un nouvel objet SoapParam.

Liste de paramètres

data

Les données à passer ou à retourner. Vous pouvez passer ce paramètre directement en tant qu'une valeur PHP, mais dans ce cas, il sera nommé paramN et le service SOAP ne le comprendra pas.

name

Le nom du paramètre.

Exemples

Exemple #1 Quelques exemples

<?php
$client 
= new SoapClient(null,array('location' => "http://localhost/soap.php",
                                    
'uri'      => "http://test-uri/"));
$client->SomeFunction(new SoapParam($a"a"),
                      new 
SoapParam($b"b"),
                      new 
SoapParam($c"c"));
?>

Voir aussi



SoapVar> <SoapParam::__construct
[edit] Last updated: Fri, 10 Feb 2012
 
add a note add a note User Contributed Notes SoapParam::SoapParam
Alex 24-Feb-2010 05:20
You probably want to try SoapVar instead of SoapParam if you want to specify attributes/namespace.
Alex 24-Feb-2010 05:18
Make sure to always cast your parameters prior to creating a SoapParam.  Otherwise you will wind up with an incorrect xsi:type and possibly no value.

$value = 0;
$param0 = new SoapParam(
                $value, $param0_name);

will give you:

<$param0_name xsi:type="xsd:null"></$param0_name>

while:

$value = 0;
$param0 = new SoapParam(
                (int)$value, $param0_name);

<$param0_name xsi:type="xsd:int">0</$param0_name>

which is probably what you want.
barryking93 at gmail dot com 05-Dec-2007 02:42
You have to use SoapVar instead of SoapParam if you want it to do something fancy like using different opening and closing tags.  I ran into this using the SOAP API for Zimbra.
Jeremy 12-Jul-2007 08:31
Is there anyway to create a SOAP parameter like:

<a n="something">DATA</a>

If I try to form a param using the following code the resulting request is:

Code: SoapParam("DATA", "a n=\"something\"");
Result: <a n="something">DATA</a n="something">

This is giving me an error from the SOAP server because its expecting a properly formed closing tag without the encapsulated attribute.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites