SOAP SoapClient::__setSoapHeaders
(PHP 5 >= 5.0.5, PHP 7, PHP 8)
SoapClient::__setSoapHeaders — Sets SOAP headers for subsequent calls
설명
public SoapClient::__setSoapHeaders(SoapHeader|array|null $headers
= null
): bool
SOAP 요청과 함께 보낼 헤더를 정의합니다.
메모: 이 메서드를 호출하면 이전 값이 대체됩니다.
매개변수
headers
- 설정할 헤더입니다. SoapHeader 개체 또는 SoapHeader 개체의 배열일 수 있습니다. 지정하지 않거나
null
로 설정하면 헤더가 삭제됩니다.
반환 값
성공하면 true
를, 실패하면 false
를 반환합니다.
Examples
예제 #1 SoapClient::__setSoapHeaders() 예제
<?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);
?>
예제 #2 Set Multiple Headers
<?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);
?>