SoapClient->__construct()

SoapClient->__construct() --  SoapClient constructor

Description

class SoapClient {

__construct ( mixed wsdl [, array options] )

}

This constructor allows creating SoapClient objects in WSDL or non-WSDL mode.

Parameters

wsdl

URI of the WSDL file or NULL if working in non-WSDL mode.

options

An array of option. If working in WSDL mode, this parameter is optional. If working in non-WSDL mode, you must set the location and uri options, where location is a URL to request and uri is a target namespace of the SOAP service.

The style and use options only work in non-WSDL mode. In WSDL mode, they comes from the WSDL file.

The soap_version option specifies whether to use SOAP 1.1, or SOAP 1.2 client.

For HTTP authentication, you may use the login and password options. For making a HTTP connection through a proxy server, use the options proxy_host, proxy_port, proxy_login and proxy_password.

Examples

Example 1. SoapClient examples

<?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(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));

?>