SOAP SoapClient::__doRequest

(PHP 5, PHP 7, PHP 8)

SoapClient::__doRequest — OAP 요청을 수행합니다.


설명

public SoapClient::__doRequest(
    string $request,
    string $location,
    string $action,
    int $version,
    bool $oneWay = false
): ?string
                

HTTP를 통해 SOAP 요청을 수행합니다.

이 메서드는 다른 전송 계층을 구현하고 추가 XML 처리 또는 기타 목적을 수행하기 위해 하위 클래스에서 재정의될 수 있습니다.


매개변수

request
XML SOAP 요청입니다.
location
요청할 URL입니다.
action
SOAP 작업.
version
SOAP 버전.
oneWay
oneWay가 1로 설정되면 이 메서드는 아무 것도 반환하지 않습니다. 응답이 예상되지 않는 경우 사용합니다.

반환 값

XML SOAP 응답.


변경 로그

버전 설명
8.0.0 oneWay의 유형은 이제 bool입니다. 이전에는 int였습니다.

Examples

예제 #1 SoapClient::__doRequest() 예제

                  
<?php
function Add($x,$y) {
  return $x+$y;
}

class LocalSoapClient extends SoapClient {

  function __construct($wsdl, $options) {
    parent::__construct($wsdl, $options);
    $this->server = new SoapServer($wsdl, $options);
    $this->server->addFunction('Add');
  }

  function __doRequest($request, $location, $action, $version, $one_way = 0) {
    ob_start();
    $this->server->handle($request);
    $response = ob_get_contents();
    ob_end_clean();
    return $response;
  }

}

$x = new LocalSoapClient(NULL,array('location'=>'test://',
                                   'uri'=>'http://testuri.org'));
var_dump($x->Add(3,4));
?>