SoapServer::SoapServer
(PHP 5, PHP 7)
SoapServer::SoapServer — SoapServer constructor
Description
This constructor allows the creation of SoapServer objects in WSDL or non-WSDL mode.
Parameters
-
wsdl
-
To use the SoapServer in WSDL mode, pass the URI of a WSDL file. Otherwise, pass
NULL
and set the uri option to the target namespace for the server. -
options
-
Allow setting a default SOAP version (soap_version), internal character encoding (encoding), and actor URI (actor).
The classmap option can be used to map some WSDL types to PHP classes. This option must be an array with WSDL types as keys and names of PHP classes as values.
The typemap option is an array of type mappings. Type mapping is an array with keys type_name, type_ns (namespace URI), from_xml (callback accepting one string parameter) and to_xml (callback accepting one object parameter).
The cache_wsdl option is one of
WSDL_CACHE_NONE
,WSDL_CACHE_DISK
,WSDL_CACHE_MEMORY
orWSDL_CACHE_BOTH
.There is also a features option which can be set to
SOAP_WAIT_ONE_WAY_CALLS
,SOAP_SINGLE_ELEMENT_ARRAYS
,SOAP_USE_XSI_ARRAY_TYPE
.The send_errors option can be set to
FALSE
to sent a generic error message ("Internal error") instead of the specific error message sent otherwise.
Examples
Example #1 SoapServer::SoapServer() example
<?php
$server = new SoapServer("some.wsdl");
$server = new SoapServer("some.wsdl", array('soap_version' => SOAP_1_2));
$server = new SoapServer("some.wsdl", array('actor' => "http://example.org/ts-tests/C"));
$server = new SoapServer("some.wsdl", array('encoding'=>'ISO-8859-1'));
$server = new SoapServer(null, array('uri' => "http://test-uri/"));
class MyBook {
public $title;
public $author;
}
$server = new SoapServer("books.wsdl", array('classmap' => array('book' => "MyBook")));
?>
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-soapserver.soapserver.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.