SOAP 函数
PHP 手册

SoapHeader->__construct

(No version information available, might be only in CVS)

SoapHeader->__construct SoapHeader constructor

说明

SoapHeader
__construct ( string $namespace , string $name [, mixed $data [, bool $mustUnderstand [, mixed $actor ]]] )

Constructs a new SoapHeader object.

参数

namespace

The namespace of the SOAP header element.

name

The name of the SOAP header element.

data

A SOAP header's content. It can be a PHP value or a SoapVar object.

mustUnderstand

Value of the mustUnderstand attribute of the SOAP header element.

actor

Value of the actor attribute of the SOAP header element.

范例

Example #1 Basic Example

<?php
$client 
= new SoapClient(null, array('location' => "http://localhost/soap.php",
                                     
'uri'      => "http://test-uri/"));
$client->__soapCall("echoVoid"nullnull,
                new 
SoapHeader('http://soapinterop.org/echoheader/',
                               
'echoMeStringRequest',
                               
'hello world'));
?>

Example #2 Complex Type With Attributes

<?php
$client 
= new SoapClient('http://example.com/webservice.asmx?wsdl');

$attributes = array('attr1' => 'value1''attr2' => 'value2');

// the type_name and type_namespace parameters must be specified 
// when specifying attributes
$complex_type = new SOAPVar($attributes
                        
SOAP_ENC_OBJECT
                        
'ComplexType'// type_name
                        
'http://www.example.com/namespace'// type_namespace
                        
'complex_type',
                        
'http://www.example.com/namespace');


$header = new SOAPHeader('http://www.example.com/namespace',
                         
'ComplexType',
                         
$complex_type,
                         
true);

$client->__soapCall("someFunc"nullnull$header);
?>

参见


SOAP 函数
PHP 手册