Esempio n. 1
0
 /**
  * Handle the WSDL request
  */
 protected function renderWsdl()
 {
     $uriParts = parse_url($this->getServiceUri());
     if (!is_array($uriParts)) {
         return;
     }
     unset($uriParts['query']);
     $wsdl = new WSDLCreator($this->serverClass, $this->getServiceUri());
     $wsdl->setNamespace(HttpUtility::buildUrl($uriParts));
     $wsdl->renderWSDL();
 }
<?php

use WSDL\DocumentLiteralWrapper;
use WSDL\WSDLCreator;
use WSDL\XML\Styles\DocumentLiteralWrapped;
require_once '../../vendor/autoload.php';
ini_set("soap.wsdl_cache_enabled", 0);
$wsdl = new WSDLCreator('SimpleSoapServer', 'http://localhost/wsdl-creator/examples/document_literal_wrapped/SimpleExampleSoapServer.php');
$wsdl->setNamespace("http://foo.bar/")->setBindingStyle(new DocumentLiteralWrapped());
if (isset($_GET['wsdl'])) {
    $wsdl->renderWSDL();
    exit;
}
$wsdl->renderWSDLService();
$server = new SoapServer('http://localhost/wsdl-creator/examples/document_literal_wrapped/SimpleExampleSoapServer.php?wsdl', array('uri' => $wsdl->getNamespaceWithSanitizedClass(), 'location' => $wsdl->getLocation(), 'style' => SOAP_DOCUMENT, 'use' => SOAP_LITERAL, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
$server->setObject(new DocumentLiteralWrapper(new SimpleSoapServer()));
$server->handle();
class SimpleSoapServer
{
    /**
     * @WebMethod
     * @param string $name
     * @param int $age
     * @return string $nameWithAge
     */
    public function getNameWithAge($name, $age)
    {
        return 'Your name is: ' . $name . ' and you have ' . $age . ' years old';
    }
    /**
     * @WebMethod
Esempio n. 3
0
 /**
  * Handle soap server
  */
 public function handle()
 {
     $wsdl = new WSDLCreator($this->soapApiClass, $this->endpoint);
     $wsdl->setNamespace($this->namespace);
     isset($_GET[$this->wsdlQueryString]) ? $wsdl->renderWSDL() : $this->setupSoapServer($wsdl);
 }