mirror of
https://github.com/php/doc-ja.git
synced 2026-03-24 07:02:08 +01:00
859 lines
33 KiB
XML
859 lines
33 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: f309e78f9439ae5d063a284cefb4b375233aa785 Maintainer: mumumu Status: ready -->
|
|
|
|
<refentry xml:id="soapclient.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>SoapClient::__construct</refname>
|
|
<refpurpose>SoapClient のコンストラクタ</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<constructorsynopsis role="SoapClient">
|
|
<modifier>public</modifier> <methodname>SoapClient::__construct</methodname>
|
|
<methodparam><type class="union"><type>string</type><type>null</type></type><parameter>wsdl</parameter></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter>options</parameter><initializer>[]</initializer></methodparam>
|
|
</constructorsynopsis>
|
|
<para>
|
|
SOAP サービスに接続するための
|
|
<classname>SoapClient</classname>
|
|
オブジェクトを生成します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>wsdl</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
サービスを記述した <acronym>WSDL</acronym> ファイルまたは URI。
|
|
これは自動的にクライアントを設定します。
|
|
指定されない場合、クライアントは 非WSDL モードで動作します。
|
|
</para>
|
|
<note>
|
|
<para>
|
|
デフォルトでは、
|
|
WSDL ファイルはパフォーマンスのためキャッシュされます。
|
|
このキャッシュ機能を無効にしたり、設定を変更する場合は、
|
|
<link linkend="soap.configuration.list">SOAP &ConfigureOptions;</link>
|
|
や
|
|
<link linkend="soapclient.construct.options.cache-wsdl">
|
|
<literal>cache_wsdl</literal> オプション</link>
|
|
を参照ください。
|
|
</para>
|
|
</note>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>options</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
SOAP クライアントに指定する追加オプションを連想配列で指定します。
|
|
<parameter>wsdl</parameter> が指定された場合、
|
|
このパラメータはオプションです。
|
|
指定されない場合、
|
|
<literal>location</literal> と<literal>url</literal>
|
|
オプションを指定する必要があります。
|
|
<variablelist>
|
|
<varlistentry xml:id="soapclient.construct.options.location">
|
|
<term>
|
|
<parameter>location</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
リクエストを送信する SOAP サーバーのURL
|
|
</para>
|
|
<para>
|
|
<parameter>wsdl</parameter> パラメータが指定されない場合、
|
|
必須です。
|
|
<parameter>wsdl</parameter> と
|
|
<literal>location</literal> が指定された場合、
|
|
<literal>location</literal> オプションは
|
|
WSDL ファイルで指定されたあらゆる location を上書きします。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.uri">
|
|
<term>
|
|
<parameter>uri</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
SOAP サービスのターゲット名前空間です。
|
|
</para>
|
|
<para>
|
|
<parameter>wsdl</parameter>
|
|
が指定されていない場合、このパラメータは必須です。
|
|
そうでない場合、この値は無視されます。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.style">
|
|
<term>
|
|
<parameter>style</parameter>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<constant>SOAP_RPC</constant> と
|
|
<constant>SOAP_DOCUMENT</constant> を使うと、
|
|
このクライアントで使うバインディングスタイルを指定します。
|
|
<constant>SOAP_RPC</constant> は
|
|
RPCスタイルのバインディングを指定します。
|
|
この場合の SOAP リクエストのボディには、
|
|
関数コールの標準エンコーディングが含まれます。
|
|
<constant>SOAP_DOCUMENT</constant> は
|
|
ドキュメントスタイルのバインディングを指定します。
|
|
この場合の SOAP リクエストのボディには、
|
|
サービス定義を記した XML ドキュメントが含まれます。
|
|
</para>
|
|
<para>
|
|
<parameter>wsdl</parameter> が指定された場合、
|
|
このオプションは無視され、
|
|
スタイルは WDSL ファイルから読み込まれます。
|
|
</para>
|
|
<para>
|
|
このオプションと
|
|
<parameter>wsdl</parameter> パラメータ
|
|
を両方指定しなかった場合、
|
|
RPCスタイルを使います。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.use">
|
|
<term>
|
|
<parameter>use</parameter>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<constant>SOAP_ENCODED</constant> や
|
|
<constant>SOAP_LITERAL</constant> を使うと、
|
|
このクライアントで使うエンコーディングスタイルを指定します。
|
|
<constant>SOAP_ENCODED</constant> は、
|
|
SOAP 仕様で定義された型を使い、エンコーディングを指定します。
|
|
<constant>SOAP_LITERAL</constant> は、
|
|
サービスで定義されたスキームを使い、
|
|
エンコーディングを指定します。
|
|
</para>
|
|
<para>
|
|
<parameter>wsdl</parameter> が指定された場合、
|
|
このオプションは無視され、
|
|
エンコーディングは WDSL ファイルから読み込まれます。
|
|
</para>
|
|
<para>
|
|
このオプションと
|
|
<parameter>wsdl</parameter> パラメータ
|
|
を両方指定しなかった場合、
|
|
"encoded" スタイルを使います。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.soap-version">
|
|
<term>
|
|
<parameter>soap_version</parameter>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
使用する SOAP プロトコルのバージョンを指定します:
|
|
SOAP 1.1 の場合は <constant>SOAP_1_1</constant> を指定します。
|
|
SOAP 1.2 の場合は <constant>SOAP_1_2</constant> を指定します。
|
|
</para>
|
|
<para>
|
|
省略した場合は、SOAP 1.1 を使います。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.authentication">
|
|
<term>
|
|
<parameter>authentication</parameter>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
HTTP 認証をリクエスト時に使う際の、
|
|
認証方法を指定します。
|
|
<constant>SOAP_AUTHENTICATION_BASIC</constant>
|
|
と <constant>SOAP_AUTHENTICATION_DIGEST</constant>
|
|
が指定できます。
|
|
</para>
|
|
<para>
|
|
省略された場合、
|
|
かつ <literal>login</literal> オプションが指定されると
|
|
Basic 認証を使います。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.login">
|
|
<term>
|
|
<parameter>login</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Basic 認証と、Digest 認証で使うユーザー名を指定します。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.password">
|
|
<term>
|
|
<parameter>password</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Basic 認証と、Digest 認証で使うパスワードを指定します。
|
|
</para>
|
|
<para>
|
|
HTTPS クライアント認証で使う
|
|
<literal>passphrase</literal> と混同しないようにして下さい。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.local-cert">
|
|
<term>
|
|
<parameter>local_cert</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
HTTPS 認証で使うクライアント証明書のパス。
|
|
証明書ファイルは、
|
|
証明書と秘密鍵が両方入った状態で、
|
|
<acronym>PEM</acronym>エンコードされている必要があります。
|
|
</para>
|
|
<para>
|
|
このファイルには、発行者のチェインも含めることができます。
|
|
それらを含める場合、クライアント証明書の後に置く必要があります。
|
|
</para>
|
|
<para>
|
|
<link linkend="soapclient.construct.options.stream-context">
|
|
<parameter>stream_context</parameter></link>
|
|
でも設定できます。
|
|
この場合、秘密鍵のファイルは別に指定できます。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.passphrase">
|
|
<term>
|
|
<parameter>passphrase</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<literal>local_cert</literal>
|
|
オプションで指定したクライアント証明書のための
|
|
パスフレーズ。
|
|
</para>
|
|
<para>
|
|
Basic 認証や Digest 認証で使う
|
|
<literal>password</literal> と混同しないようにして下さい。
|
|
</para>
|
|
<para>
|
|
<link linkend="soapclient.construct.options.stream-context">
|
|
<parameter>stream_context</parameter></link>
|
|
でも設定できます。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.proxy-host">
|
|
<term>
|
|
<parameter>proxy_host</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
HTTPリクエスト時に使う、
|
|
プロキシサーバーとして用いるホスト名を指定します。
|
|
</para>
|
|
<para>
|
|
<literal>proxy_port</literal>
|
|
オプションも指定する必要があります。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.proxy-port">
|
|
<term>
|
|
<parameter>proxy_port</parameter>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<literal>proxy_host</literal>
|
|
で指定したプロキシサーバーに接続する際に使うポート番号。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.proxy-login">
|
|
<term>
|
|
<parameter>proxy_login</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<literal>proxy_host</literal>
|
|
で指定したプロキシサーバーに接続する際に、
|
|
Basic 認証で用いるオプションのユーザー名
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.proxy-password">
|
|
<term>
|
|
<parameter>proxy_password</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<literal>proxy_host</literal>
|
|
で指定したプロキシサーバーに接続する際に、
|
|
Basic 認証で用いるオプションのパスワード
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.compression">
|
|
<term>
|
|
<parameter>compression</parameter>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
SOAP リクエストとレスポンスの圧縮を有効にします。
|
|
</para>
|
|
<para>
|
|
この値は、3つの値を ビット演算のOR で指定します:
|
|
オプションの <constant>SOAP_COMPRESSION_ACCEPT</constant>
|
|
は、"Accept-Encoding" ヘッダを指定します。
|
|
<constant>SOAP_COMPRESSION_GZIP</constant>
|
|
や <constant>SOAP_COMPRESSION_DEFLATE</constant>
|
|
は、使用する圧縮アルゴリズムと、
|
|
リクエストで使う圧縮レベルを 1 から 9 の間の数値で指定します。
|
|
たとえば、双方向の gzip 圧縮を最高の圧縮レベルで行う場合は、
|
|
<literal>SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9</literal>
|
|
を指定します。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.encoding">
|
|
<term>
|
|
<parameter>encoding</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
内部的な文字エンコーディングを指定します。
|
|
リクエストはここで指定されたエンコーディングから、
|
|
常に UTF-8 に変換して送られ、
|
|
レスポンスはこのエンコーディングに変換されます。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.trace">
|
|
<term>
|
|
<parameter>trace</parameter>
|
|
<type>bool</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
リクエストやレスポンスのキャプチャを行います。
|
|
キャプチャした情報は
|
|
<methodname>SoapClient::__getLastRequest</methodname>,
|
|
<methodname>SoapClient::__getLastRequestHeaders</methodname>,
|
|
<methodname>SoapClient::__getLastResponse</methodname>,
|
|
<methodname>SoapClient::__getLastResponseHeaders</methodname>.
|
|
を使ってアクセスできます。
|
|
</para>
|
|
<para>
|
|
省略した場合のデフォルト値は &false; です。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.classmap">
|
|
<term>
|
|
<parameter>classmap</parameter>
|
|
<type>array</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
WSDL 型を PHP クラスにマッピングするために使用可能です。
|
|
このオプションには、キーとしてWSDL 型、
|
|
値として PHP クラスの名前を持つ配列を指定する必要があります。
|
|
型の名前は、
|
|
要素の(タグ)名前と一致させる必要はないことに注意して下さい。
|
|
</para>
|
|
<para>
|
|
指定するクラス名は、常に
|
|
<link linkend="language.namespaces">名前空間</link>
|
|
で完全修飾されているべきですし、
|
|
<literal>\</literal> で始まってはいけません。
|
|
正しい名前は、
|
|
<link linkend="language.oop5.basic.class.class">::class</link>
|
|
を使えば生成できます。
|
|
</para>
|
|
<para>
|
|
クラスのインスタンスを生成する場合、
|
|
コンストラクタはコールされず、
|
|
個別のプロパティに対して
|
|
マジックメソッド
|
|
<link linkend="object.set">__set()</link> と
|
|
<link linkend="object.get">__get()</link> が
|
|
コールされる点にも注意して下さい。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.typemap">
|
|
<term>
|
|
<parameter>typemap</parameter>
|
|
<type>array</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
ユーザー定義のコールバック関数を使って、
|
|
型マッピングを定義します。
|
|
型マッピングは配列で定義され、
|
|
キーは
|
|
<literal>type_name</literal> (XML 要素型を指定した文字列)、
|
|
<literal>type_ns</literal> (名前空間URI を指定した文字列)、
|
|
<literal>from_xml</literal> (文字列を受け取り、
|
|
オブジェクトを返す <type>callable</type>)、
|
|
<literal>to_xml</literal> (オブジェクトをひとつ受け取り、
|
|
文字列を返す <type>callable</type>) です。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.exceptions">
|
|
<term>
|
|
<parameter>exceptions</parameter>
|
|
<type>bool</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
エラーが起きた際に、
|
|
<classname>SoapFault</classname>
|
|
をスローするかどうかを指定します。
|
|
</para>
|
|
<para>
|
|
デフォルトは &true; です。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.connection-timeout">
|
|
<term>
|
|
<parameter>connection_timeout</parameter>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
SOAP サービスに接続する際のタイムアウト秒数を指定します。
|
|
これを使用しても、
|
|
レスポンスが遅いサービスのタイムアウトを定義することはできません。
|
|
サービスのコールが完了するまでの待ち時間を制限するには、
|
|
<link linkend="ini.default-socket-timeout">default_socket_timeout</link>
|
|
が使えます。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.cache-wsdl">
|
|
<term>
|
|
<parameter>cache_wsdl</parameter>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<parameter>wsdl</parameter> を指定した場合、
|
|
かつ
|
|
<link linkend="ini.soap.wsdl-cache-enabled">soap.wsdl_cache_enabled</link> が有効になっている場合に、
|
|
このオプションはキャッシュのタイプを指定します。
|
|
<constant>WSDL_CACHE_NONE</constant>,
|
|
<constant>WSDL_CACHE_DISK</constant>,
|
|
<constant>WSDL_CACHE_MEMORY</constant>,
|
|
<constant>WSDL_CACHE_BOTH</constant> のいずれかが指定できます。
|
|
</para>
|
|
<para>
|
|
ふたつのタイプのキャッシュが利用できます。
|
|
WSDL を現在のプロセスのメモリにキャッシュする
|
|
インメモリのキャッシュと、
|
|
WSDL をディスク上にキャッシュし、
|
|
全てのプロセスと共有するディスクキャッシュがあります。
|
|
ディスクキャッシュで使うディレクトリは
|
|
<link linkend="ini.soap.wsdl-cache-dir">soap.wsdl_cache_dir</link>
|
|
で指定できます。
|
|
どちらのタイプのキャッシュでも、
|
|
<link linkend="ini.soap.wsdl-cache-ttl">soap.wsdl_cache_ttl</link>
|
|
で指定した寿命があります。
|
|
インメモリキャッシュの場合、
|
|
<link linkend="ini.soap.wsdl-cache-limit">soap.wsdl_cache_limit</link>
|
|
でキャッシュエントリの数の最大値も指定できます。
|
|
</para>
|
|
<para>
|
|
この値を指定しない場合、
|
|
<link linkend="ini.soap.wsdl-cache">
|
|
soap.wsdl_cache</link> オプションの値を使います。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.user-agent">
|
|
<term>
|
|
<parameter>user_agent</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
リクエストをする際に
|
|
<literal>User-Agent</literal> で使う値。
|
|
</para>
|
|
<para>
|
|
<link linkend="soapclient.construct.options.stream-context">
|
|
<parameter>stream_context</parameter></link>
|
|
でも指定できます。
|
|
</para>
|
|
<para>
|
|
この値を指定しない場合、
|
|
<literal>"PHP-SOAP/"</literal> の後に、
|
|
<constant>PHP_VERSION</constant> の値を付けたものを使います。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.stream-context">
|
|
<term>
|
|
<parameter>stream_context</parameter>
|
|
<type>resource</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
追加のオプションを設定できる
|
|
<link linkend="context">stream context</link>。
|
|
これは
|
|
<function>stream_context_create</function> で生成できます。
|
|
</para>
|
|
<para>
|
|
このコンテキストには、
|
|
<link linkend="context.socket">socket context options</link>,
|
|
<link linkend="context.ssl">SSL context options</link>,
|
|
<link linkend="context.http">HTTP context options</link> が含まれます:
|
|
<literal>content_type</literal>, <literal>header</literal>,
|
|
<literal>max_redirects</literal>, <literal>protocol_version</literal>,
|
|
<literal>user_agent</literal> が設定できます。
|
|
</para>
|
|
<para>
|
|
<literal>'header'</literal> コンテキストオプションで指定された場合、以下のHTTPヘッダは自動生成され、無視されることに注意して下さい:
|
|
<literal>host</literal>, <literal>connection</literal>,
|
|
<literal>user-agent</literal>, <literal>content-length</literal>,
|
|
<literal>content-type</literal>, <literal>cookie</literal>,
|
|
<literal>authorization</literal>, <literal>proxy-authorization</literal>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.features">
|
|
<term>
|
|
<parameter>features</parameter>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
以下の機能を有効にするための、ひとつ以上のビットマスク:
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<constant>SOAP_SINGLE_ELEMENT_ARRAYS</constant>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
レスポンスを配列にデコードする際には、
|
|
特定の親要素の中で要素名が一度または複数回現れるかをデフォルトで自動検知します。
|
|
一度しか現れない要素については、
|
|
オブジェクトのプロパティを通じてコンテンツに直接アクセスできます。
|
|
複数回現れる要素については、
|
|
プロパティには配列が含まれ、
|
|
マッチする要素の内容の配列が入ります。
|
|
</para>
|
|
<para>
|
|
<constant>SOAP_SINGLE_ELEMENT_ARRAYS</constant>
|
|
が有効になった場合、
|
|
一度しか現れない要素は要素数がひとつの配列になります。
|
|
これは全ての要素と一貫性を保つためです。
|
|
これは、レスポンスにスキーマを含んでいるWSDLを使っている場合にのみ意味があります。具体的には、以下の例を参照ください。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<constant>SOAP_USE_XSI_ARRAY_TYPE</constant>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<link linkend="soapclient.construct.options.use"><literal>use</literal>
|
|
オプション</link> を使ったり、
|
|
WSDL プロパティを <literal>encoded</literal>
|
|
に設定した場合に、
|
|
配列の型をスキーマ特有のそれにするのではなく、
|
|
<literal>SOAP-ENC:Array</literal> にします。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<constant>SOAP_WAIT_ONE_WAY_CALLS</constant>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
WDSL が一方向のリクエストを指定していた場合であっても、
|
|
レスポンスを待つ。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.keep-alive">
|
|
<term>
|
|
<parameter>keep_alive</parameter>
|
|
<type>bool</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<literal>Connection: Keep-Alive</literal> ヘッダや
|
|
<literal>Connection: close</literal>
|
|
を送信するかどうかを boolean で指定します。
|
|
</para>
|
|
<para>
|
|
デフォルトは &true; です。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="soapclient.construct.options.ssl-method">
|
|
<term>
|
|
<parameter>ssl_method</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
セキュアな HTTP 接続で用いる、
|
|
SSL または TLS のバージョンを指定します。
|
|
<constant>SOAP_SSL_METHOD_SSLv2</constant>
|
|
や <constant>SOAP_SSL_METHOD_SSLv3</constant>
|
|
を指定すると、
|
|
それぞれ SSL 2、 SSL 3 を強制的に使います。
|
|
<constant>SOAP_SSL_METHOD_SSLv23</constant>
|
|
を指定しても意味がありません。
|
|
これは後方互換のためだけに存在しています。
|
|
PHP 7.2.0 以降では、
|
|
<constant>SOAP_SSL_METHOD_TLS</constant>
|
|
を指定しても同様に意味がありません。
|
|
これより前のバージョンでは、
|
|
この定数を指定すると TLS 1.0 を強制的に使っていました。
|
|
</para>
|
|
<para>
|
|
SSL バージョン 2 と 3 はセキュアでないとみなされています。
|
|
よってインストール済みの OpenSSL
|
|
ライブラリではサポートされていない可能性があることに注意しましょう。
|
|
</para>
|
|
<para>
|
|
このオプションは
|
|
PHP 8.1.0 以降では
|
|
<emphasis role="strong">推奨されません</emphasis>。
|
|
個別の TLS のバージョンを指定できる、
|
|
より柔軟性に富んだ代替があります。
|
|
<link linkend="soapclient.construct.options.stream-context">
|
|
<parameter>stream_context</parameter></link> オプションを
|
|
'crypto_method'
|
|
コンテキストパラメータと一緒に使うようにして下さい。
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
// TLS 1.3 のみを使うよう指定
|
|
$context = stream_context_create([
|
|
'ssl' => [
|
|
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT
|
|
]
|
|
]);
|
|
$client = new SoapClient("some.wsdl", ['context' => $context]);
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
<methodname>SoapClient::__construct</methodname> は、
|
|
非 WSDL モードで <literal>location</literal> や
|
|
<literal>uri</literal> オプションを指定しなかったときに
|
|
<constant>E_ERROR</constant> エラーとなります。
|
|
</para>
|
|
<para>
|
|
<parameter>wsdl</parameter> URI が読み込めなかった場合に
|
|
<classname>SoapFault</classname> をスローします。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>
|
|
<methodname>SoapClient::__construct</methodname> の例
|
|
</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$client = new SoapClient("some.wsdl");
|
|
|
|
$client = new SoapClient("some.wsdl", array('soap_version' => SOAP_1_2));
|
|
|
|
$client = new SoapClient("some.wsdl", array('login' => "some_name",
|
|
'password' => "some_password"));
|
|
|
|
$client = new SoapClient("some.wsdl", array('proxy_host' => "localhost",
|
|
'proxy_port' => 8080));
|
|
|
|
$client = new SoapClient("some.wsdl", array('proxy_host' => "localhost",
|
|
'proxy_port' => 8080,
|
|
'proxy_login' => "some_name",
|
|
'proxy_password' => "some_password"));
|
|
|
|
$client = new SoapClient("some.wsdl", array('local_cert' => "cert_key.pem"));
|
|
|
|
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
|
|
'uri' => "http://test-uri/"));
|
|
|
|
$client = new SoapClient(null, array('location' => "http://localhost/soap.php",
|
|
'uri' => "http://test-uri/",
|
|
'style' => SOAP_DOCUMENT,
|
|
'use' => SOAP_LITERAL));
|
|
|
|
$client = new SoapClient("some.wsdl",
|
|
array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9));
|
|
|
|
$client = new SoapClient("some.wsdl", array('encoding'=>'ISO-8859-1'));
|
|
|
|
class MyBook {
|
|
public $title;
|
|
public $author;
|
|
}
|
|
|
|
$client = new SoapClient("books.wsdl", array('classmap' => array('book' => "MyBook")));
|
|
|
|
$typemap = array(
|
|
array("type_ns" => "http://schemas.example.com",
|
|
"type_name" => "book",
|
|
"from_xml" => "unserialize_book",
|
|
"to_xml" => "serialize_book")
|
|
);
|
|
$client = new SoapClient("books.wsdl", array('typemap' => $typemap));
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
|
|
<para>
|
|
<example>
|
|
<title><constant>SOAP_SINGLE_ELEMENT_ARRAYS</constant> の機能を使う</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/* Assuming a response like this, and an appropriate WSDL:
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:example">
|
|
<SOAP-ENV:Body>
|
|
<response>
|
|
<collection>
|
|
<item>Single</item>
|
|
</collection>
|
|
<collection>
|
|
<item>First</item>
|
|
<item>Second</item>
|
|
</collection>
|
|
</response>
|
|
</SOAP-ENV:Body>
|
|
</SOAP-ENV:Envelope>
|
|
*/
|
|
|
|
echo "Default:\n";
|
|
|
|
$client = new TestSoapClient(__DIR__ . '/temp.wsdl');
|
|
$response = $client->exampleRequest();
|
|
var_dump( $response->collection[0]->item );
|
|
var_dump( $response->collection[1]->item );
|
|
|
|
echo "\nWith SOAP_SINGLE_ELEMENT_ARRAYS:\n";
|
|
|
|
$client = new TestSoapClient(__DIR__ . '/temp.wsdl', ['features' => SOAP_SINGLE_ELEMENT_ARRAYS]);
|
|
$response = $client->exampleRequest();
|
|
var_dump( $response->collection[0]->item );
|
|
var_dump( $response->collection[1]->item );
|
|
]]>
|
|
</programlisting>
|
|
|
|
&example.outputs;
|
|
|
|
<screen>
|
|
<![CDATA[
|
|
Default:
|
|
string(6) "Single"
|
|
array(2) {
|
|
[0] =>
|
|
string(5) "First"
|
|
[1] =>
|
|
string(6) "Second"
|
|
}
|
|
|
|
With SOAP_SINGLE_ELEMENT_ARRAYS:
|
|
array(1) {
|
|
[0] =>
|
|
string(6) "Single"
|
|
}
|
|
array(2) {
|
|
[0] =>
|
|
string(5) "First"
|
|
[1] =>
|
|
string(6) "Second"
|
|
}
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|