コード例 #1
0
<?php

use WSDL\WSDLCreator;
require_once '../../vendor/autoload.php';
ini_set("soap.wsdl_cache_enabled", 0);
$wsdl = new WSDLCreator('SimpleSoapServer', 'http://localhost/wsdl-creator/examples/rpc_literal/SimpleExampleSoapServer.php');
$wsdl->setNamespace("http://foo.bar/");
if (isset($_GET['wsdl'])) {
    $wsdl->renderWSDL();
    exit;
}
$wsdl->renderWSDLService();
$server = new SoapServer('http://localhost/wsdl-creator/examples/rpc_literal/SimpleExampleSoapServer.php?wsdl', array('uri' => $wsdl->getNamespaceWithSanitizedClass(), 'location' => $wsdl->getLocation(), 'style' => SOAP_RPC, 'use' => SOAP_LITERAL));
$server->setClass('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
     * @param string[] $names
     * @return string $userNames
コード例 #2
0
<?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
コード例 #3
0
<?php

use WSDL\WSDLCreator;
use WSDL\XML\Styles\RpcEncoded;
require_once '../../vendor/autoload.php';
ini_set("soap.wsdl_cache_enabled", 0);
$wsdl = new WSDLCreator('SimpleSoapServer', 'http://localhost/wsdl-creator/examples/rpc_encoded/SimpleExampleSoapServer.php');
$wsdl->setNamespace("http://foo.bar/")->setBindingStyle(new RpcEncoded());
if (isset($_GET['wsdl'])) {
    $wsdl->renderWSDL();
    exit;
}
$wsdl->renderWSDLService();
$server = new SoapServer('http://localhost/wsdl-creator/examples/rpc_encoded/SimpleExampleSoapServer.php?wsdl', array('uri' => $wsdl->getNamespaceWithSanitizedClass(), 'location' => $wsdl->getLocation(), 'style' => SOAP_RPC, 'use' => SOAP_ENCODED));
$server->setClass('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
     * @param string[] $names
コード例 #4
0
<?php

require_once '../../vendor/autoload.php';
$serviceClassName = '\\NovoBoletoPHP\\Api\\Soap\\Service';
$currentLocation = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
use WSDL\WSDLCreator;
if (isset($_GET['service']) || isset($_GET['wsdl'])) {
    $wsdl = new WSDL\WSDLCreator($serviceClassName, str_replace('wsdl', '', $currentLocation));
    $wsdl->setNamespace($_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['SERVER_NAME'] . '/');
    if (isset($_GET['wsdl'])) {
        $wsdl->renderWSDL();
    } else {
        if (isset($_GET['service'])) {
            $wsdl->renderWSDLService();
        }
    }
    exit;
}
$server = new SoapServer(null, array('uri' => $currentLocation));
$server->setClass($serviceClassName, array('cachePath' => false, 'imageUrl' => dirname(dirname($currentLocation)) . '/images'));
$server->handle();
コード例 #5
0
ファイル: SoapServer.php プロジェクト: sirdiego/autoloader
 /**
  * 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();
 }
コード例 #6
0
ファイル: SamanUssd.php プロジェクト: iamtartan/saman-ussd
 /**
  * Setup soap server
  *
  * @param WSDLCreator $wsdl
  */
 protected function setupSoapServer(WSDLCreator $wsdl)
 {
     $request = file_get_contents('php://input');
     $server = new SoapServer($this->endpoint . '?' . $this->wsdlQueryString, array_merge(['uri' => $wsdl->getNamespaceWithSanitizedClass(), 'cache_wsdl' => WSDL_CACHE_NONE, 'location' => $wsdl->getLocation(), 'style' => SOAP_RPC, 'use' => SOAP_LITERAL], $this->options));
     $server->setClass($this->soapApiClass, $this->listener, $this->callbacks);
     $server->handle($request);
 }
コード例 #7
0
ファイル: soapServer.php プロジェクト: bobans1985/IBSService
<?php

require_once 'autoload.php';
use WSDL\WSDLCreator;
//ƒл¤ запросов отовсюду
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods : POST,GET,OPTIONS");
header("Access-Control-Allow-Headers : SoapAction,Origin, X-Requested-With, Content-Type, Accept");
$wsdl = new WSDL\WSDLCreator('soapServerClass', 'http://localhost:8888/soapServerClass.php');
$wsdl->setNamespace("http://localhost:8888/");
if (isset($_GET['wsdl'])) {
    $wsdl->renderWSDL();
    exit;
}
$wsdl->renderWSDLService();
$server = new SoapServer(null, array('uri' => 'http://localhost:8888/soapServer.php', 'encoding' => 'Windows-1251'));
$server->setClass('soapServerClass');
$server->handle();