PHP Doku:: SoapParam constructor - soapparam.soapparam.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzWeb ServicesSOAPThe SoapParam classSoapParam::SoapParam

Ein Service von Reinhard Neidl - Webprogrammierung.

The SoapParam class

<<SoapParam->__construct()

The SoapVar class>>

SoapParam::SoapParam

(PHP 5 >= 5.0.1)

SoapParam::SoapParamSoapParam constructor

Beschreibung

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

Constructs a new SoapParam object.

Parameter-Liste

data

The data to pass or return. This parameter can be passed directly as PHP value, but in this case it will be named as paramN and the SOAP service may not understand it.

name

The parameter name.

Beispiele

Beispiel #1 SoapParam::SoapParam() example

<?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"));
?>

Siehe auch


4 BenutzerBeiträge:
- Beiträge aktualisieren...
Alex
25.02.2010 2:20
You probably want to try SoapVar instead of SoapParam if you want to specify attributes/namespace.
Alex
25.02.2010 2: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
5.12.2007 23: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.07.2007 17: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.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)