首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

SoapClient::__setSoapHeaders

(PHP 5 >= 5.0.5, PHP 7)

SoapClient::__setSoapHeaders — Sets SOAP headers for subsequent calls

Description

代码语言:javascript
复制
public bool SoapClient::__setSoapHeaders ([ mixed $soapheaders ] )

Defines headers to be sent along with the SOAP requests.

Note: Calling this method will replace any previous values.

Parameters

soapheaders

The headers to be set. It could be SoapHeader object or array of SoapHeader objects. If not specified or set to NULL, the headers will be deleted.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example #1 SoapClient::__setSoapHeaders() example

代码语言:javascript
复制
<?php

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

$client->__setSoapHeaders($header);

$client->__soapCall("echoVoid",?null);
?>

Example #2 Set Multiple Headers

代码语言:javascript
复制
<?php

$client?=?new?SoapClient(null,?array('location'?=>?"http://localhost/soap.php",
?????????????????????????????????????'uri'??????=>?"http://test-uri/"));
$headers?=?array();

$headers[]?=?new?SoapHeader('http://soapinterop.org/echoheader/',?
????????????????????????????'echoMeStringRequest',
????????????????????????????'hello?world');

$headers[]?=?new?SoapHeader('http://soapinterop.org/echoheader/',?
????????????????????????????'echoMeStringRequest',
????????????????????????????'hello?world?again');

$client->__setSoapHeaders($headers);

$client->__soapCall("echoVoid",?null);
?>

← SoapClient::__setLocation

SoapClient::__soapCall →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com