File: construct.xml

package info (click to toggle)
php-doc 20241205~git.dfcbb86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 70,956 kB
  • sloc: xml: 968,269; php: 23,883; javascript: 671; sh: 177; makefile: 37
file content (795 lines) | stat: -rw-r--r-- 29,578 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<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 constructor</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>
   Creates a <classname>SoapClient</classname> object to connect to a SOAP service.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>wsdl</parameter></term>
     <listitem>
      <para>
       URI of a WSDL file describing the service, which is used to automatically
       configure the client. If not provided, the client will operate in non-WSDL
       mode.
      </para>
      <note>
       <para>
        By default, the WSDL file will be cached for performance. To disable
        or configure this caching, see
        <link linkend="soap.configuration.list">SOAP &ConfigureOptions;</link>
        and the <link linkend="soapclient.construct.options.cache-wsdl">
        <literal>cache_wsdl</literal> option</link>.
       </para>
      </note>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>options</parameter></term>
     <listitem>
      <para>
       An associative array specifying additional options for the SOAP client.
       If <parameter>wsdl</parameter> is provided, this is optional; otherwise,
       at least <literal>location</literal> and <literal>url</literal> must be
       provided.
       <variablelist>
        <varlistentry xml:id="soapclient.construct.options.location">
         <term>
          <parameter>location</parameter>
          <type>string</type>
         </term>
         <listitem>
          <para>
           The URL of the SOAP server to send the request to.
          </para>
          <para>
           Required if the <parameter>wsdl</parameter> parameter is not provided.
           If both a <parameter>wsdl</parameter> parameter and
           <literal>location</literal> option are provided, the
           <literal>location</literal> option will over-ride any location
           specified in the WSDL file.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.uri">
         <term>
          <parameter>uri</parameter>
          <type>string</type>
         </term>
         <listitem>
          <para>
           The target namespace of the SOAP service.
          </para>
          <para>
           Required if the <parameter>wsdl</parameter> parameter is not provided;
           ignored otherwise.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.style">
         <term>
          <parameter>style</parameter>
          <type>int</type>
         </term>
         <listitem>
          <para>
           Specifies the binding style to use for this client, using the constants
           <constant>SOAP_RPC</constant> and <constant>SOAP_DOCUMENT</constant>.
           <constant>SOAP_RPC</constant> indicates RPC-style binding, where the
           SOAP request body contains a standard encoding of a function call.
           <constant>SOAP_DOCUMENT</constant> indicates document-style binding,
           where the SOAP request body contains an XML document with
           service-defined meaning.
          </para>
          <para>
           If the <parameter>wsdl</parameter> parameter is provided, this
           option is ignored, and the style is read from the WSDL file.
          </para>
          <para>
           If neither this option nor the <parameter>wsdl</parameter> parameter
           is provided, RPC-style is used.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.use">
         <term>
          <parameter>use</parameter>
          <type>int</type>
         </term>
         <listitem>
          <para>
           Specifies the encoding style to use for this client, using the
           constants <constant>SOAP_ENCODED</constant> or <constant>SOAP_LITERAL</constant>.
           <constant>SOAP_ENCODED</constant> indicates encoding using the types
           defined in the SOAP specification.
           <constant>SOAP_LITERAL</constant> indicates encoding using a schema
           defined by the service.
          </para>
          <para>
           If the <parameter>wsdl</parameter> parameter is provided, this
           option is ignored, and the encoding is read from the WSDL file.
          </para>
          <para>
           If neither this option nor the <parameter>wsdl</parameter> parameter
           is provided, the "encoded" style is used.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.soap-version">
         <term>
          <parameter>soap_version</parameter>
          <type>int</type>
         </term>
         <listitem>
          <para>
           Specifies the version of the SOAP protocol to use:
           <constant>SOAP_1_1</constant> for SOAP 1.1,
           or <constant>SOAP_1_2</constant> for SOAP 1.2.
          </para>
          <para>
           If omitted, SOAP 1.1 is used.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.authentication">
         <term>
          <parameter>authentication</parameter>
          <type>int</type>
         </term>
         <listitem>
          <para>
           Specifies the authentication method when using HTTP authentication
           in requests. The value may be either
           <constant>SOAP_AUTHENTICATION_BASIC</constant>
           or <constant>SOAP_AUTHENTICATION_DIGEST</constant>.
          </para>
          <para>
           If omitted, and the <literal>login</literal> option is provided,
           Basic Authentication is used.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.login">
         <term>
          <parameter>login</parameter>
          <type>string</type>
         </term>
         <listitem>
          <para>
           Username to use with HTTP Basic or Digest Authentication.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.password">
         <term>
          <parameter>password</parameter>
          <type>string</type>
         </term>
         <listitem>
          <para>
           Password to use with HTTP Basic or Digest Authentication.
          </para>
          <para>
           Not to be confused with <literal>passphrase</literal>,
           which is used with HTTPS Client Certificate authentication.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.local-cert">
         <term>
          <parameter>local_cert</parameter>
          <type>string</type>
         </term>
         <listitem>
          <para>
           Path to a client certificate for use with HTTPS authentication.
           It must be a <acronym>PEM</acronym> encoded file which contains your certificate
           and private key.
          </para>
          <para>
           The file can also include a chain of issuers, which must come
           after the client certificate.
          </para>
          <para>
           Can also be set via
           <link linkend="soapclient.construct.options.stream-context">
           <parameter>stream_context</parameter></link>,
           which also supports specifying a separate private key file.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.passphrase">
         <term>
          <parameter>passphrase</parameter>
          <type>string</type>
         </term>
         <listitem>
          <para>
           Passphrase for the client certificate specified in the
           <literal>local_cert</literal> option.
          </para>
          <para>
           Not to be confused with <literal>password</literal>,
           which is used for Basic or Digest Authentication.
          </para>
          <para>
           Can also be set via
           <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>
           Hostname to use as a proxy server for HTTP requests.
          </para>
          <para>
           The <literal>proxy_port</literal> option must also be specified.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.proxy-port">
         <term>
          <parameter>proxy_port</parameter>
          <type>int</type>
         </term>
         <listitem>
          <para>
           TCP port to use when connecting to the proxy server
           specified in <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>
           Optional username to authenticate with the proxy server
           specified in <literal>proxy_host</literal>, using HTTP
           Basic Authentication.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.proxy-password">
         <term>
          <parameter>proxy_password</parameter>
          <type>string</type>
         </term>
         <listitem>
          <para>
           Optional password to authenticate with the proxy server
           specified in <literal>proxy_host</literal>, using HTTP
           Basic Authentication.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.compression">
         <term>
          <parameter>compression</parameter>
          <type>int</type>
         </term>
         <listitem>
          <para>
           Enables compression of HTTP SOAP requests and responses.
          </para>
          <para>
           The value should be the bitwise OR of three parts:
           an optional <constant>SOAP_COMPRESSION_ACCEPT</constant>,
           to send an "Accept-Encoding" header; either
           <constant>SOAP_COMPRESSION_GZIP</constant>
           or <constant>SOAP_COMPRESSION_DEFLATE</constant> to indicate
           the compression algorithm to use; and a number between 1 and 9
           to indicate the level of compression to use in the request.
           For example, to enable two-way gzip compression with the maximum
           compression level, use
           <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>
           Defines the internal character encoding. Requests are always sent
           in UTF-8, and converted to and from this encoding.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.trace">
         <term>
          <parameter>trace</parameter>
          <type>bool</type>
         </term>
         <listitem>
          <para>
           Captures request and response information, which can then be
           accessed with the methods
           <methodname>SoapClient::__getLastRequest</methodname>,
           <methodname>SoapClient::__getLastRequestHeaders</methodname>,
           <methodname>SoapClient::__getLastResponse</methodname>,
           and <methodname>SoapClient::__getLastResponseHeaders</methodname>.
          </para>
          <para>
           If omitted, defaults to &false;
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.classmap">
         <term>
          <parameter>classmap</parameter>
          <type>array</type>
         </term>
         <listitem>
          <para>
           Used to map types defined in the WSDL to PHP classes.
           It should be specified as an associative <type>array</type> with
           type names from the WSDL as keys and names of PHP classes as values.
           Note that the type names of an element is not necessarily the same as
           the element (tag) name.
          </para>
          <para>
           The provided class names should always be fully qualified with any
           <link linkend="language.namespaces">namespaces</link>, and never
           start with a leading <literal>\</literal>. The correct form can be
           generated by using
           <link linkend="language.oop5.basic.class.class">::class</link>.
          </para>
          <para>
           Note that when creating a class, the constructor will not be called,
           but magic <link linkend="object.set">__set()</link> and
           <link linkend="object.get">__get()</link> methods for individual
           properties will be.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.typemap">
         <term>
          <parameter>typemap</parameter>
          <type>array</type>
         </term>
         <listitem>
          <para>
           Used to define type mappings using user-defined callback functions.
           Each type mapping should be an array with keys
           <literal>type_name</literal> (<type>string</type> specifying the
           XML element type);
           <literal>type_ns</literal> (<type>string</type> containing namespace
           URI);
           <literal>from_xml</literal> (<type>callable</type> accepting one
           string parameter and returning an object) and
           <literal>to_xml</literal> (<type>callable</type> accepting one
           object parameter and returning a string).
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.exceptions">
         <term>
          <parameter>exceptions</parameter>
          <type>bool</type>
         </term>
         <listitem>
          <para>
           Defines whether errors throw exceptions of type
           <classname>SoapFault</classname>.
          </para>
          <para>
           Defaults to &true;
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.connection-timeout">
         <term>
          <parameter>connection_timeout</parameter>
          <type>int</type>
         </term>
         <listitem>
          <para>
           Defines a timeout in seconds for the connection to the SOAP service.
           This option does not define a timeout for services with slow responses.
           To limit the time to wait for calls to finish the
           <link linkend="ini.default-socket-timeout">default_socket_timeout</link>
           configuration option is available.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.cache-wsdl">
         <term>
          <parameter>cache_wsdl</parameter>
          <type>int</type>
         </term>
         <listitem>
          <para>
           If the <parameter>wsdl</parameter> parameter is provided, and the
           <link linkend="ini.soap.wsdl-cache-enabled">soap.wsdl_cache_enabled</link>
           configuration option is on, this option determines the type of caching.
           One of <constant>WSDL_CACHE_NONE</constant>,
           <constant>WSDL_CACHE_DISK</constant>,
           <constant>WSDL_CACHE_MEMORY</constant> or
           <constant>WSDL_CACHE_BOTH</constant>.
          </para>
          <para>
           Two types of cache are available: in-memory caching, which caches the WSDL
           in the memory of the current process; and disk caching, which caches the
           WSDL in a file on disk, shared between all processes.
           The directory to use for the disk cache is determined by the
           <link linkend="ini.soap.wsdl-cache-dir">soap.wsdl_cache_dir</link>
           configuration option.
           Both caches use the same lifetime, determined by the
           <link linkend="ini.soap.wsdl-cache-ttl">soap.wsdl_cache_ttl</link>
           configuration option. The in-memory cache also has a maximum number of entries
           determined by the
           <link linkend="ini.soap.wsdl-cache-limit">soap.wsdl_cache_limit</link>
           configuration option.
          </para>
          <para>
           If not specified, the <link linkend="ini.soap.wsdl-cache">
           soap.wsdl_cache</link> configuration option will be used.
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.user-agent">
         <term>
          <parameter>user_agent</parameter>
          <type>string</type>
         </term>
         <listitem>
          <para>
           The value to use in the <literal>User-Agent</literal> HTTP header
           when making requests.
          </para>
          <para>
           Can also be set via <link linkend="soapclient.construct.options.stream-context">
           <parameter>stream_context</parameter></link>.
          </para>
          <para>
           If not specified, the user agent will be <literal>"PHP-SOAP/"</literal>
           followed by the value of <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>
           A <link linkend="context">stream context</link> created by
           <function>stream_context_create</function>, which allows additional
           options to be set.
          </para>
          <para>
           The context may include <link linkend="context.socket">socket context options</link>,
           <link linkend="context.ssl">SSL context options</link>,
           plus selected <link linkend="context.http">HTTP context options</link>:
           <literal>content_type</literal>, <literal>header</literal>,
           <literal>max_redirects</literal>, <literal>protocol_version</literal>,
           and <literal>user_agent</literal>.
          </para>
          <para>
           Note that the following HTTP headers are generated automatically or from other
           options, and will be ignored if specified in the <literal>'header'</literal>
           context option: <literal>host</literal>, <literal>connection</literal>,
           <literal>user-agent</literal>, <literal>content-length</literal>,
           <literal>content-type</literal>, <literal>cookie</literal>,
           <literal>authorization</literal>, and <literal>proxy-authorization</literal>
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.features">
         <term>
          <parameter>features</parameter>
          <type>int</type>
         </term>
         <listitem>
          <para>
           A bitmask to enable one or more of the following features:
           <variablelist>
            <varlistentry>
             <term>
              <constant>SOAP_SINGLE_ELEMENT_ARRAYS</constant>
             </term>
             <listitem>
              <para>
               When decoding a response to an array, the default behaviour is to detect whether
               an element name appears once or multiple times in a particular parent element.
               For elements which appear only once, an object property allows direct access to
               the content; for elements which appear more than once, the property contains an
               array with the content of each matching element.
              </para>
              <para>
               If the <constant>SOAP_SINGLE_ELEMENT_ARRAYS</constant> feature is enabled,
               elements which appear only once are placed in a single-element array, so that
               access is consistent for all elements. This only has an effect when using a WSDL
               containing a schema for the response. See Examples section for an illustration.
              </para>
             </listitem>
            </varlistentry>
            <varlistentry>
             <term>
              <constant>SOAP_USE_XSI_ARRAY_TYPE</constant>
             </term>
             <listitem>
              <para>
               When the <link linkend="soapclient.construct.options.use"><literal>use</literal>
               option</link> or WSDL property is set to <literal>encoded</literal>,
               force arrays to use a type of <literal>SOAP-ENC:Array</literal>, rather than a
               schema-specific type.
              </para>
             </listitem>
            </varlistentry>
            <varlistentry>
             <term>
              <constant>SOAP_WAIT_ONE_WAY_CALLS</constant>
             </term>
             <listitem>
              <para>
               Wait for a response even if the WSDL indicates a one-way request.
              </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>
           a boolean value defining whether
           to send the <literal>Connection: Keep-Alive</literal> header or
           <literal>Connection: close</literal>.
          </para>
          <para>
           Defaults to &true;
          </para>
         </listitem>
        </varlistentry>
        <varlistentry xml:id="soapclient.construct.options.ssl-method">
         <term>
          <parameter>ssl_method</parameter>
          <type>string</type>
         </term>
         <listitem>
          <para>
           Specifies the SSL or TLS protocol version to use with secure HTTP
           connections, instead of the default negotiation.
           Specifying <constant>SOAP_SSL_METHOD_SSLv2</constant>
           or <constant>SOAP_SSL_METHOD_SSLv3</constant> will force use of SSL 2
           or SSL 3, respectively.
           Specifying <constant>SOAP_SSL_METHOD_SSLv23</constant> has no effect;
           the constant exists only for backwards compatibility.
           As of PHP 7.2, specifying <constant>SOAP_SSL_METHOD_TLS</constant>
           also has no effect; in earlier versions, it forced use of TLS 1.0.
          </para>
          <para>
           Note that SSL versions 2 and 3 are considered insecure, and may not
           be supported by the installed OpenSSL library.
          </para>
          <para>
           This option is <emphasis>DEPRECATED</emphasis> as of PHP 8.1.0.
           A more flexible alternative, which allows specifying
           individual versions of TLS, is to use the
           <link linkend="soapclient.construct.options.stream-context">
           <parameter>stream_context</parameter></link> option with
           the 'crypto_method' context parameter.
           <example>
            <title>Specifying use of TLS 1.3 only</title>
            <programlisting role="php">
<![CDATA[
<?php
$context = stream_context_create([
    'ssl' => [
        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT
     ]
]);
$client = new SoapClient("some.wsdl", ['context' => $context]);
]]>
            </programlisting>
           </example>
          </para>
         </listitem>
        </varlistentry>
       </variablelist>
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="errors">
  &reftitle.errors;
  <para>
   <methodname>SoapClient::__construct</methodname> will generate an
   <constant>E_ERROR</constant> error if the <literal>location</literal> and
   <literal>uri</literal> options aren't provided in non-WSDL mode.
  </para>
  <para>
   A <classname>SoapFault</classname> exception will be thrown if the
   <parameter>wsdl</parameter> URI cannot be loaded.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>
     <methodname>SoapClient::__construct</methodname> example
    </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>Using the <constant>SOAP_SINGLE_ELEMENT_ARRAYS</constant> feature</title>
    <programlisting role="php">
<![CDATA[
/* 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
-->