예제 #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
 /**
  * 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
 /**
  * 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
<?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();