首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

SoapServer::SoapServer

(PHP 5 >= 5.0.1, PHP 7)

SoapServer::SoapServer — SoapServer constructor

Description

代码语言:javascript
复制
public SoapServer::SoapServer ( mixed $wsdl [, array $options ] )

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 or WSDL_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

代码语言:javascript
复制
<?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")));

?>

Changelog

Version

Description

5.2.0

Added the typemap option.

See Also

  • SoapClient::SoapClient() - SoapClient constructor

← SoapServer::setPersistence

SoapFault →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com