function soap_server::configureWSDL in Salesforce Suite 5
Same name in this branch
- 5 includes/nusoap.php \soap_server::configureWSDL()
- 5 includes/nusoap.orig.php \soap_server::configureWSDL()
Same name and namespace in other branches
- 5.2 includes/nusoap.php \soap_server::configureWSDL()
- 5.2 includes/nusoap.orig.php \soap_server::configureWSDL()
Sets up wsdl object. Acts as a flag to enable internal WSDL generation
Parameters
string $serviceName, name of the service:
mixed $namespace optional 'tns' service namespace or false:
mixed $endpoint optional URL of service endpoint or false:
string $style optional (rpc|document) WSDL style (also specified by operation):
string $transport optional SOAP transport:
mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false:
File
- includes/
nusoap.php, line 3996
Class
- soap_server
- soap_server allows the user to create a SOAP server that is capable of receiving messages and returning responses
Code
function configureWSDL($serviceName, $namespace = false, $endpoint = false, $style = 'rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false) {
global $HTTP_SERVER_VARS;
if (isset($_SERVER)) {
$SERVER_NAME = $_SERVER['SERVER_NAME'];
$SERVER_PORT = $_SERVER['SERVER_PORT'];
$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$HTTPS = $_SERVER['HTTPS'];
}
elseif (isset($HTTP_SERVER_VARS)) {
$SERVER_NAME = $HTTP_SERVER_VARS['SERVER_NAME'];
$SERVER_PORT = $HTTP_SERVER_VARS['SERVER_PORT'];
$SCRIPT_NAME = isset($HTTP_SERVER_VARS['PHP_SELF']) ? $HTTP_SERVER_VARS['PHP_SELF'] : $HTTP_SERVER_VARS['SCRIPT_NAME'];
$HTTPS = $HTTP_SERVER_VARS['HTTPS'];
}
else {
$this
->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
}
if ($SERVER_PORT == 80) {
$SERVER_PORT = '';
}
else {
$SERVER_PORT = ':' . $SERVER_PORT;
}
if (false == $namespace) {
$namespace = "http://{$SERVER_NAME}/soap/{$serviceName}";
}
if (false == $endpoint) {
if ($HTTPS == '1' || $HTTPS == 'on') {
$SCHEME = 'https';
}
else {
$SCHEME = 'http';
}
$endpoint = "{$SCHEME}://{$SERVER_NAME}{$SERVER_PORT}{$SCRIPT_NAME}";
}
if (false == $schemaTargetNamespace) {
$schemaTargetNamespace = $namespace;
}
$this->wsdl = new wsdl();
$this->wsdl->serviceName = $serviceName;
$this->wsdl->endpoint = $endpoint;
$this->wsdl->namespaces['tns'] = $namespace;
$this->wsdl->namespaces['soap'] = 'http://schemas.xmlsoap.org/wsdl/soap/';
$this->wsdl->namespaces['wsdl'] = 'http://schemas.xmlsoap.org/wsdl/';
if ($schemaTargetNamespace != $namespace) {
$this->wsdl->namespaces['types'] = $schemaTargetNamespace;
}
$this->wsdl->schemas[$schemaTargetNamespace][0] = new xmlschema('', '', $this->wsdl->namespaces);
$this->wsdl->schemas[$schemaTargetNamespace][0]->schemaTargetNamespace = $schemaTargetNamespace;
$this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/soap/encoding/'][0] = array(
'location' => '',
'loaded' => true,
);
$this->wsdl->schemas[$schemaTargetNamespace][0]->imports['http://schemas.xmlsoap.org/wsdl/'][0] = array(
'location' => '',
'loaded' => true,
);
$this->wsdl->bindings[$serviceName . 'Binding'] = array(
'name' => $serviceName . 'Binding',
'style' => $style,
'transport' => $transport,
'portType' => $serviceName . 'PortType',
);
$this->wsdl->ports[$serviceName . 'Port'] = array(
'binding' => $serviceName . 'Binding',
'location' => $endpoint,
'bindingType' => 'http://schemas.xmlsoap.org/wsdl/soap/',
);
}