23 Commits

Author SHA1 Message Date
e4cb612aed Created a client classmap even when it is empty 2014-04-30 10:54:07 +02:00
59ea6b1ce0 Merge pull request #33 from borissamardzija/master
Update Curl class to support CURLOPT_CAINFO and CURLOPT_CAPATH options
2014-04-25 13:36:04 +02:00
7bb849e394 Update Curl class to support CURLOPT_CAINFO and CURLOPT_CAPATH options 2014-04-25 11:16:34 +02:00
02722eae8f Merge pull request #32 from mremi/filter-request-headers
Added method to tweak HTTP headers of request
2014-04-24 17:22:00 +02:00
b7581f29b0 Removed reference to return an array of HTTP headers 2014-04-24 09:29:58 +02:00
dc6e1e0889 Merge pull request #31 from mremi/http-auth
Added extra option to configure HTTP authentication
2014-04-24 08:38:03 +02:00
f986400dc2 Merge pull request #30 from mremi/method-visibility
Updated visibility from private to protected
2014-04-24 08:36:23 +02:00
67410805ba Added method to tweak HTTP headers of request 2014-04-22 22:29:11 +02:00
2ae7515294 Added extra option to configure HTTP authentication 2014-04-22 22:05:04 +02:00
cdfc3cd5bd Updated visibility from private to protected 2014-04-22 21:53:14 +02:00
9ac755d86e [SoapBundle] Set _format route to xml 2013-12-13 15:25:20 +01:00
321dcf3058 [SoapBundle] Set wsdl request type only if the "wsdl" parameter in present in URL 2013-12-13 11:24:25 +01:00
3a2b8e32ee [SoapBundle] Enhanced SoapFault management 2013-12-13 08:26:18 +01:00
fd5154a469 Fixed typo 2013-12-10 15:25:09 +01:00
188f282a87 [SoapWsdl] Specify an empty message if the input is empty 2013-12-10 15:25:09 +01:00
1b4e262c60 [SoapBundle] Simplified conditional statement 2013-12-08 00:25:20 +01:00
60e3714602 [SoapBundle][SoapCommon] Removed unused TypeRepository in Definition\Method classes 2013-12-08 00:23:30 +01:00
1e82d7fdd7 Fix WSDL schema stylesheet including 2013-12-07 19:55:33 +01:00
8788d7595d Cleaned unused method, property, variable or parameter 2013-12-02 16:02:29 +01:00
b45224587a Added use TypeConverterInterface 2013-12-02 15:39:59 +01:00
c8baf14c75 Fixed typo 2013-12-02 15:39:39 +01:00
53849c68e0 Removed unused use statement 2013-12-02 15:35:36 +01:00
ecdf7e1872 Fixed an undefined variable
Fixed commit c830097430
Fixed issue #22
2013-11-20 08:45:12 +01:00
35 changed files with 163 additions and 149 deletions

View File

@ -15,8 +15,7 @@ namespace BeSimple\SoapBundle\Controller;
use BeSimple\SoapBundle\Handler\ExceptionHandler;
use BeSimple\SoapBundle\Soap\SoapRequest;
use BeSimple\SoapBundle\Soap\SoapResponse;
use BeSimple\SoapServer\Exception as SoapException;
use BeSimple\SoapServer\SoapServerBuilder;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@ -96,9 +95,10 @@ class SoapWebServiceController extends ContainerAware
)
));
$query = $this->container->get('request')->query;
if (!$query->has('wsdl') && !$query->has('WSDL')) {
$this->container->get('request')->setRequestFormat('xml');
$request = $this->container->get('request');
$query = $request->query;
if ($query->has('wsdl') || $query->has('WSDL')) {
$request->setRequestFormat('wsdl');
}
return $response;
@ -130,16 +130,30 @@ class SoapWebServiceController extends ContainerAware
'logger' => $logger,
));
$server = $this
->container
->get(sprintf('besimple.soap.context.%s', $webservice))
->getServerBuilder()
->withHandler(new ExceptionHandler($exception, $details))
$handler = new ExceptionHandler($exception, $details);
if ($soapFault = $request->query->get('_besimple_soap_fault')) {
$handler->setSoapFault($soapFault);
// Remove parameter from query because cannot be Serialized in Logger
$request->query->remove('_besimple_soap_fault');
}
$server = SoapServerBuilder::createWithDefaults()
->withWsdl(__DIR__.'/../Handler/wsdl/exception.wsdl')
->withWsdlCacheNone()
->withHandler($handler)
->build()
;
ob_start();
$server->handle($request->getContent());
$server->handle(
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://besim.pl/soap/exception/1.0/">'.
'<soapenv:Header/>'.
'<soapenv:Body>'.
'<ns:exception />'.
'</soapenv:Body>'.
'</soapenv:Envelope>'
);
return new Response(ob_get_clean());
}

View File

@ -12,8 +12,6 @@ namespace BeSimple\SoapBundle\Converter;
use BeSimple\SoapBundle\ServiceDefinition\ServiceDefinition;
use BeSimple\SoapBundle\Util\Assert;
use BeSimple\SoapBundle\Util\QName;
use BeSimple\SoapBundle\Util\String;
/**
* @author Christian Kerl <christian-kerl@web.de>
@ -50,8 +48,6 @@ class TypeRepository
public function fixTypeInformation(ServiceDefinition $definition)
{
$typeMap = $this->defaultTypeMap;
foreach($definition->getAllTypes() as $type) {
$phpType = $type->getPhpType();
$xmlType = $type->getXmlType();
@ -67,4 +63,4 @@ class TypeRepository
$type->setXmlType($xmlType);
}
}
}
}

View File

@ -13,6 +13,7 @@ namespace BeSimple\SoapBundle\Converter;
use BeSimple\SoapBundle\Soap\SoapRequest;
use BeSimple\SoapBundle\Soap\SoapResponse;
use BeSimple\SoapBundle\Util\String;
use BeSimple\SoapCommon\Converter\TypeConverterInterface;
/**
* @author Christian Kerl <christian-kerl@web.de>
@ -52,4 +53,4 @@ class XopIncludeTypeConverter implements TypeConverterInterface
{
return $data;
}
}
}

View File

@ -84,7 +84,7 @@ class BeSimpleSoapExtension extends Extension
foreach ($config as $client => $options) {
$definition = new DefinitionDecorator('besimple.soap.client.builder');
$context = $container->setDefinition(sprintf('besimple.soap.client.builder.%s', $client), $definition);
$container->setDefinition(sprintf('besimple.soap.client.builder.%s', $client), $definition);
$definition->replaceArgument(0, $options['wsdl']);
@ -104,12 +104,8 @@ class BeSimpleSoapExtension extends Extension
$definition->replaceArgument(1, $defOptions);
if (!empty($options['classmap'])) {
$classmap = $this->createClientClassmap($client, $options['classmap'], $container);
$definition->replaceArgument(2, new Reference($classmap));
} else {
$definition->replaceArgument(2, null);
}
$classmap = $this->createClientClassmap($client, $options['classmap'], $container);
$definition->replaceArgument(2, new Reference($classmap));
$this->createClient($client, $container);
}
@ -118,11 +114,13 @@ class BeSimpleSoapExtension extends Extension
private function createClientClassmap($client, array $classmap, ContainerBuilder $container)
{
$definition = new DefinitionDecorator('besimple.soap.classmap');
$context = $container->setDefinition(sprintf('besimple.soap.classmap.%s', $client), $definition);
$container->setDefinition(sprintf('besimple.soap.classmap.%s', $client), $definition);
$definition->setMethodCalls(array(
array('set', array($classmap)),
));
if (!empty($classmap)) {
$definition->setMethodCalls(array(
array('set', array($classmap)),
));
}
return sprintf('besimple.soap.classmap.%s', $client);
}
@ -130,7 +128,7 @@ class BeSimpleSoapExtension extends Extension
private function createClient($client, ContainerBuilder $container)
{
$definition = new DefinitionDecorator('besimple.soap.client');
$context = $container->setDefinition(sprintf('besimple.soap.client.%s', $client), $definition);
$container->setDefinition(sprintf('besimple.soap.client.%s', $client), $definition);
$definition->setFactoryService(sprintf('besimple.soap.client.builder.%s', $client));
}
@ -142,7 +140,7 @@ class BeSimpleSoapExtension extends Extension
$contextId = 'besimple.soap.context.'.$config['name'];
$definition = new DefinitionDecorator('besimple.soap.context.'.$bindingSuffix);
$context = $container->setDefinition($contextId, $definition);
$container->setDefinition($contextId, $definition);
if (isset($config['cache_type'])) {
$config['cache_type'] = $this->getCacheType($config['cache_type']);

View File

@ -2,7 +2,6 @@
namespace BeSimple\SoapBundle\EventListener;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
class RequestFormatListener

View File

@ -67,12 +67,18 @@ class SoapExceptionListener extends ExceptionListener
// hack to retrieve the current WebService name in the controller
$request->query->set('_besimple_soap_webservice', $webservice);
$exception = $event->getException();
if ($exception instanceof \SoapFault) {
$request->query->set('_besimple_soap_fault', $exception);
}
parent::onKernelException($event);
}
public static function getSubscribedEvents()
{
return array(
// Must be called before ExceptionListener of HttpKernel component
KernelEvents::EXCEPTION => array('onKernelException', -64),
);
}

View File

@ -23,6 +23,7 @@ class ExceptionHandler
{
protected $exception;
protected $details;
protected $soapFault;
public function __construct(FlattenException $exception, $details = null)
{
@ -30,8 +31,17 @@ class ExceptionHandler
$this->details = $details;
}
public function setSoapFault(\SoapFault $soapFault)
{
$this->soapFault = $soapFault;
}
public function __call($method, $arguments)
{
if (isset($this->soapFault)) {
throw $this->soapFault;
}
$code = $this->exception->getStatusCode();
throw new ReceiverSoapFault(

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://besim.pl/soap/exception/1.0/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Exception" targetNamespace="http://besim.pl/soap/exception/1.0/">
<portType name="ExceptionPortType">
<operation name="exception">
<input message="tns:empty"/>
<output message="tns:empty"/>
</operation>
</portType>
<message name="empty" />
<binding name="ExceptionBinding" type="tns:ExceptionPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="exception">
<soap:operation soapAction="http://besim.pl/soap/exception/1.0/exception"/>
<input>
<soap:body use="literal" namespace="http://besim.pl/soap/exception/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="literal" namespace="http://besim.pl/soap/exception/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="ExceptionService">
<port name="ExceptionPort" binding="tns:ExceptionBinding">
<soap:address location="http://localhost/soap/Exception"/>
</port>
</service>
</definitions>

View File

@ -6,13 +6,13 @@
<route id="_webservice_call" pattern="/{webservice}">
<default key="_controller">BeSimpleSoapBundle:SoapWebService:Call</default>
<default key="_format">soap</default>
<default key="_format">xml</default>
<requirement key="_method">POST</requirement>
</route>
<route id="_webservice_definition" pattern="/{webservice}">
<default key="_controller">BeSimpleSoapBundle:SoapWebService:Definition</default>
<default key="_format">wsdl</default>
<default key="_format">xml</default>
<requirement key="_method">GET</requirement>
</route>
</routes>

View File

@ -44,6 +44,7 @@
<argument key="binder_request_header_class">%besimple.soap.binder.request_header.rpcliteral.class%</argument>
<argument key="binder_request_class">%besimple.soap.binder.request.rpcliteral.class%</argument>
<argument key="binder_response_class">%besimple.soap.binder.response.rpcliteral.class%</argument>
<argument key="wsdl_stylesheet">%besimple.soap.definition.dumper.options.stylesheet%</argument>
</argument>
<argument type="service" id="besimple.soap.cache" />
</service>
@ -58,6 +59,7 @@
<argument key="binder_request_header_class">%besimple.soap.binder.request_header.documentwrapped.class%</argument>
<argument key="binder_request_class">%besimple.soap.binder.request.documentwrapped.class%</argument>
<argument key="binder_response_class">%besimple.soap.binder.response.documentwrapped.class%</argument>
<argument key="wsdl_stylesheet">%besimple.soap.definition.dumper.options.stylesheet%</argument>
</argument>
<argument type="service" id="besimple.soap.cache" />
</service>

View File

@ -13,8 +13,6 @@
namespace BeSimple\SoapBundle\ServiceBinding;
use BeSimple\SoapBundle\ServiceDefinition\Method;
use BeSimple\SoapBundle\ServiceDefinition\Strategy\MethodComplexType;
use BeSimple\SoapBundle\ServiceDefinition\Strategy\PropertyComplexType;
use BeSimple\SoapCommon\Definition\Type\ArrayOfType;
use BeSimple\SoapCommon\Definition\Type\ComplexType;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;
@ -55,7 +53,7 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
$type = $this->typeRepository->getType($phpType);
if ($type instanceof ArrayOfType) {
$isArray = true;
$arrayType = $type;
$array = array();
$type = $this->typeRepository->getType($type->get('item')->getType());
}
@ -65,8 +63,6 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
$phpType = $type->getPhpType();
if ($isArray) {
$array = array();
if (isset($message->item)) {
foreach ($message->item as $complexType) {
$array[] = $this->checkComplexType($phpType, $complexType);
@ -116,9 +112,8 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
$value = $this->processType($type->getType(), $value);
$messageBinder->writeProperty($property, $value);
}
if (!$type->isNillable() && null === $value) {
} elseif (!$type->isNillable()) {
// @TODO use xmlType instead of phpType
throw new \SoapFault('SOAP_ERROR_COMPLEX_TYPE', sprintf('"%s:%s" cannot be null.', ucfirst($phpType), $type->getName()));
}
}

View File

@ -13,8 +13,6 @@
namespace BeSimple\SoapBundle\ServiceBinding;
use BeSimple\SoapBundle\ServiceDefinition\Method;
use BeSimple\SoapBundle\ServiceDefinition\Strategy\PropertyComplexType;
use BeSimple\SoapBundle\ServiceDefinition\Strategy\MethodComplexType;
use BeSimple\SoapCommon\Definition\Type\ArrayOfType;
use BeSimple\SoapCommon\Definition\Type\ComplexType;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;
@ -44,7 +42,6 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface
$type = $this->typeRepository->getType($phpType);
if ($type instanceof ArrayOfType) {
$isArray = true;
$arrayType = $type;
$type = $this->typeRepository->getType($type->get('item')->getType());
}
@ -88,7 +85,7 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface
$this->messageRefs[$hash] = $message;
if (!$message instanceof $phpType) {
throw new \InvalidArgumentException(sprintf('The instance class must be "%s", "%s" given.', get_class($message), $phpType));
throw new \InvalidArgumentException(sprintf('The instance class must be "%s", "%s" given.', $phpType, get_class($message)));
}
$messageBinder = new MessageBinder($message);

View File

@ -10,7 +10,6 @@
namespace BeSimple\SoapBundle\ServiceBinding;
use BeSimple\SoapBundle\ServiceDefinition\Header;
use BeSimple\SoapBundle\ServiceDefinition\Definition;
use BeSimple\SoapBundle\Soap\SoapHeader;

View File

@ -21,8 +21,6 @@ use BeSimple\SoapCommon\Definition\Type\TypeRepository;
*/
class Definition extends BaseDefinition
{
private $complexTypes;
public function __construct(TypeRepository $typeRepository)
{
$this->typeRepository = $typeRepository;

View File

@ -16,11 +16,8 @@ use BeSimple\SoapBundle\ServiceDefinition as Definition;
use BeSimple\SoapBundle\ServiceDefinition\Annotation;
use BeSimple\SoapCommon\Definition\Type\ComplexType;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;
use Doctrine\Common\Annotations\Reader;
use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
/**
* AnnotationClassLoader loads ServiceDefinition from a PHP class and its methods.
@ -91,7 +88,6 @@ class AnnotationClassLoader extends Loader
$serviceMethod = new Definition\Method(
$annotation->getValue(),
$this->typeRepository,
$this->getController($class, $method, $annotation)
);
} elseif ($annotation instanceof Annotation\Result) {
@ -144,30 +140,6 @@ class AnnotationClassLoader extends Loader
}
}
/**
* @param \ReflectionMethod $method
* @param \BeSimple\SoapBundle\ServiceDefinition\Annotation\Param $annotation
*
* @return \BeSimple\SoapBundle\ServiceDefinition\Type
*/
private function getArgumentType(\ReflectionMethod $method, Annotation\Param $annotation)
{
$phpType = $annotation->getPhpType();
$xmlType = $annotation->getXmlType();
if (null === $phpType) {
foreach ($method->getParameters() as $param) {
if ($param->name === $annotation->getName()) {
$phpType = $param->getClass()->name;
break;
}
}
}
return new Definition\Type($phpType, $xmlType);
}
private function loadType($phpType)
{
if (false !== $arrayOf = $this->typeRepository->getArrayOf($phpType)) {
@ -177,7 +149,7 @@ class AnnotationClassLoader extends Loader
if (!$this->typeRepository->hasType($phpType)) {
$complexTypeResolver = $this->resolve($phpType, 'annotation_complextype');
if (!$complexTypeResolver) {
throw new Exception();
throw new \Exception();
}
$loaded = $complexTypeResolver->load($phpType);

View File

@ -16,7 +16,6 @@ use BeSimple\SoapBundle\ServiceDefinition\ServiceDefinition;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Config\Loader\FileLoader;
use Symfony\Component\Config\Resource\FileResource;
/**
* AnnotationFileLoader loads ServiceDefinition from annotations set
@ -62,7 +61,7 @@ class AnnotationFileLoader extends FileLoader
$path = $this->locator->locate($file);
if ($class = $this->findClass($path)) {
return $definition = $this->loader->load($class, $type);
return $this->loader->load($class, $type);
}
return null;

View File

@ -23,9 +23,9 @@ class Method extends BaseMethod
{
private $controller;
public function __construct($name, TypeRepository $typeRepository, $controller)
public function __construct($name, $controller)
{
parent::__construct($name, $typeRepository);
parent::__construct($name);
$this->controller = $controller;
}

View File

@ -11,10 +11,7 @@
namespace BeSimple\SoapBundle\Soap;
use BeSimple\SoapBundle\Util\Collection;
use Symfony\Component\HttpFoundation\Request;
use Zend\Mime\Mime;
use Zend\Mime\Message;
/**

View File

@ -11,14 +11,10 @@
namespace BeSimple\SoapBundle;
use BeSimple\SoapBundle\ServiceBinding\MessageBinderInterface;
use BeSimple\SoapBundle\ServiceBinding\ServiceBinder;
use BeSimple\SoapBundle\ServiceDefinition\Dumper\DumperInterface;
use BeSimple\SoapCommon\Converter\TypeConverterCollection;
use BeSimple\SoapWsdl\Dumper\Dumper;
use BeSimple\SoapServer\SoapServerBuilder;
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\Loader\LoaderInterface;
@ -30,8 +26,6 @@ use Symfony\Component\Config\Loader\LoaderInterface;
*/
class WebServiceContext
{
private $converterRepository;
private $options;
private $serviceDefinition;
@ -84,7 +78,7 @@ class WebServiceContext
$definition->setOption('location', $endpoint);
}
$dumper = new Dumper($definition);
$dumper = new Dumper($definition, array('stylesheet' => $this->options['wsdl_stylesheet']));
$cache->write($dumper->dump());
}

View File

@ -88,13 +88,19 @@ class Curl
curl_setopt($this->ch, CURLOPT_PROXYUSERPWD, $options['proxy_user'] . ':' . $options['proxy_password']);
}
if (isset($options['login'])) {
curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($this->ch, CURLOPT_HTTPAUTH, isset($options['extra_options']['http_auth']) ? $options['extra_options']['http_auth'] : CURLAUTH_ANY);
curl_setopt($this->ch, CURLOPT_USERPWD, $options['login'].':'.$options['password']);
}
if (isset($options['local_cert'])) {
curl_setopt($this->ch, CURLOPT_SSLCERT, $options['local_cert']);
curl_setopt($this->ch, CURLOPT_SSLCERTPASSWD, $options['passphrase']);
}
if (isset($options['ca_info'])) {
curl_setopt($this->ch, CURLOPT_CAINFO, $options['ca_info']);
}
if (isset($options['ca_path'])) {
curl_setopt($this->ch, CURLOPT_CAPATH, $options['ca_path']);
}
}
/**

View File

@ -90,7 +90,7 @@ class MimeFilter implements SoapRequestFilter, SoapResponseFilter
// TODO
$headers = $multipart->getHeadersForHttp();
list($name, $contentType) = explode(': ', $headers[0]);
list(, $contentType) = explode(': ', $headers[0]);
$request->setContentType($contentType);
}
@ -135,4 +135,4 @@ class MimeFilter implements SoapRequestFilter, SoapResponseFilter
$response->setAttachments($attachmentsRecieved);
}
}
}
}

View File

@ -113,6 +113,11 @@ class SoapClient extends \SoapClient
$this->cliWebserverWorkaround = $options['cli_webserver_workaround'];
}
$this->curl = new Curl($options);
if (isset($options['extra_options'])) {
unset($options['extra_options']);
}
$wsdlFile = $this->loadWsdl($wsdl, $options);
// TODO $wsdlHandler = new WsdlHandler($wsdlFile, $this->soapVersion);
$this->soapKernel = new SoapKernel();
@ -173,6 +178,8 @@ class SoapClient extends \SoapClient
$headers = array();
}
$headers = $this->filterRequestHeaders($soapRequest, $headers);
// execute HTTP request with cURL
$responseSuccessfull = $this->curl->exec(
$location,
@ -253,6 +260,19 @@ class SoapClient extends \SoapClient
return $soapResponse;
}
/**
* Filters HTTP headers which will be sent
*
* @param SoapRequest $soapRequest SOAP request object
* @param array $headers An array of HTTP headers
*
* @return array
*/
protected function filterRequestHeaders(SoapRequest $soapRequest, array $headers)
{
return $headers;
}
/**
* Get last request HTTP headers.
*
@ -354,7 +374,7 @@ class SoapClient extends \SoapClient
*
* @return string
*/
private function loadWsdl($wsdl, array $options)
protected function loadWsdl($wsdl, array $options)
{
// option to resolve wsdl/xsd includes
$resolveRemoteIncludes = true;

View File

@ -13,7 +13,6 @@
namespace BeSimple\SoapClient;
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
use BeSimple\SoapCommon\SoapMessage;
/**
* SoapResponse class for SoapClient. Provides factory function for response object.
@ -44,4 +43,4 @@ class SoapResponse extends CommonSoapResponse
return $response;
}
}
}

View File

@ -14,16 +14,12 @@ namespace BeSimple\SoapClient;
use ass\XmlSecurity\DSig as XmlSecurityDSig;
use ass\XmlSecurity\Enc as XmlSecurityEnc;
use ass\XmlSecurity\Key as XmlSecurityKey;
use ass\XmlSecurity\Pem as XmlSecurityPem;
use BeSimple\SoapCommon\FilterHelper;
use BeSimple\SoapCommon\Helper;
use BeSimple\SoapCommon\SoapRequest as CommonSoapRequest;
use BeSimple\SoapCommon\SoapRequestFilter;
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
use BeSimple\SoapCommon\SoapResponseFilter;
use BeSimple\SoapCommon\WsSecurityKey;
use BeSimple\SoapCommon\WsSecurityFilterClientServer;
/**
@ -214,7 +210,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
$referenceList = XmlSecurityEnc::createReferenceList($encryptedKey);
// token reference to encrypted key
$keyInfo = $this->createKeyInfo($filterHelper, self::TOKEN_REFERENCE_SECURITY_TOKEN, $guid);
$nodes = $this->createNodeListForEncryption($dom, $security);
$nodes = $this->createNodeListForEncryption($dom);
foreach ($nodes as $node) {
$type = XmlSecurityEnc::ELEMENT;
if ($node->localName == 'Body') {
@ -274,4 +270,4 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
$security->parentNode->removeChild($security);
}
}
}
}

View File

@ -14,13 +14,8 @@ namespace BeSimple\SoapClient;
use BeSimple\SoapCommon\FilterHelper;
use BeSimple\SoapCommon\Helper;
use BeSimple\SoapCommon\Mime\MultiPart as MimeMultiPart;
use BeSimple\SoapCommon\Mime\Parser as MimeParser;
use BeSimple\SoapCommon\Mime\Part as MimePart;
use BeSimple\SoapCommon\SoapRequest;
use BeSimple\SoapCommon\SoapRequestFilter;
use BeSimple\SoapCommon\SoapResponse;
use BeSimple\SoapCommon\SoapResponseFilter;
/**
* XML MIME filter that fixes the namespace of xmime:contentType attribute.
@ -72,4 +67,4 @@ class XmlMimeFilter implements SoapRequestFilter
}
}
}
}

View File

@ -12,7 +12,6 @@
namespace BeSimple\SoapCommon\Converter;
use BeSimple\SoapCommon\Helper;
use BeSimple\SoapCommon\Mime\Part as MimePart;
use BeSimple\SoapCommon\SoapKernel;
use BeSimple\SoapCommon\Converter\SoapKernelAwareInterface;

View File

@ -26,14 +26,14 @@ class Method
private $output;
private $fault;
public function __construct($name, TypeRepository $typeRepository)
public function __construct($name)
{
$this->name = $name;
$this->headers = new Message($name.'Header', $typeRepository);
$this->input = new Message($name.'Request', $typeRepository);
$this->output = new Message($name.'Response', $typeRepository);
$this->fault = new Message($name.'Fault', $typeRepository);
$this->headers = new Message($name.'Header');
$this->input = new Message($name.'Request');
$this->output = new Message($name.'Response');
$this->fault = new Message($name.'Fault');
}
public function getName()

View File

@ -14,9 +14,6 @@
namespace BeSimple\SoapCommon;
use BeSimple\SoapCommon\Mime\Part as MimePart;
use BeSimple\SoapCommon\Converter\MtomTypeConverter;
use BeSimple\SoapCommon\Converter\SwaTypeConverter;
use BeSimple\SoapCommon\SoapRequest;
use BeSimple\SoapCommon\SoapResponse;
use BeSimple\SoapCommon\SoapRequestFilter;
@ -129,4 +126,4 @@ class SoapKernel
$filter->filterResponse($response);
}
}
}
}

View File

@ -13,8 +13,6 @@
namespace BeSimple\SoapCommon;
use BeSimple\SoapCommon\Mime\Part as MimePart;
/**
* Base class for SoapRequest and SoapResponse.
*
@ -254,4 +252,4 @@ abstract class SoapMessage
{
$this->version = $version;
}
}
}

View File

@ -16,13 +16,8 @@ use ass\XmlSecurity\DSig as XmlSecurityDSig;
use ass\XmlSecurity\Enc as XmlSecurityEnc;
use ass\XmlSecurity\Key as XmlSecurityKey;
use ass\XmlSecurity\Pem as XmlSecurityPem;
use BeSimple\SoapCommon\FilterHelper;
use BeSimple\SoapCommon\Helper;
use BeSimple\SoapCommon\SoapRequest as CommonSoapRequest;
use BeSimple\SoapCommon\SoapRequestFilter;
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
use BeSimple\SoapCommon\SoapResponseFilter;
use BeSimple\SoapCommon\WsSecurityKey;
/**
@ -247,11 +242,10 @@ abstract class WsSecurityFilterClientServer
* Create a list of \DOMNodes that should be encrypted.
*
* @param \DOMDocument $dom DOMDocument to query
* @param \DOMElement $security Security element
*
* @return \DOMNodeList
*/
protected function createNodeListForEncryption(\DOMDocument $dom, \DOMElement $security)
protected function createNodeListForEncryption(\DOMDocument $dom)
{
$xpath = new \DOMXPath($dom);
$xpath->registerNamespace('SOAP-ENV', $dom->documentElement->namespaceURI);
@ -355,4 +349,4 @@ abstract class WsSecurityFilterClientServer
return null;
}
}
}

View File

@ -174,7 +174,7 @@ class WsdlHandler
return true;
// type/* match
} else {
list($ctype, $csubtype) = explode('/', $currentMimeType);
list($ctype) = explode('/', $currentMimeType);
foreach ($mimeTypes as $mimeType) {
list($type, $subtype) = explode('/', $mimeType);
if ($subtype == '*' && $type == $ctype) {
@ -202,4 +202,4 @@ class WsdlHandler
$this->domXpath->registerNamespace('soap', $this->wsdlSoapNamespace);
}
}
}
}

View File

@ -130,9 +130,9 @@ class MimeFilter implements SoapRequestFilter, SoapResponseFilter
// TODO
$headers = $multipart->getHeadersForHttp();
list($name, $contentType) = explode(': ', $headers[0]);
list(, $contentType) = explode(': ', $headers[0]);
$response->setContentType($contentType);
}
}
}
}

View File

@ -14,16 +14,12 @@ namespace BeSimple\SoapServer;
use ass\XmlSecurity\DSig as XmlSecurityDSig;
use ass\XmlSecurity\Enc as XmlSecurityEnc;
use ass\XmlSecurity\Key as XmlSecurityKey;
use ass\XmlSecurity\Pem as XmlSecurityPem;
use BeSimple\SoapCommon\FilterHelper;
use BeSimple\SoapCommon\Helper;
use BeSimple\SoapCommon\SoapRequest as CommonSoapRequest;
use BeSimple\SoapCommon\SoapRequestFilter;
use BeSimple\SoapCommon\SoapResponse as CommonSoapResponse;
use BeSimple\SoapCommon\SoapResponseFilter;
use BeSimple\SoapCommon\WsSecurityKey;
use BeSimple\SoapCommon\WsSecurityFilterClientServer;
/**
@ -230,7 +226,7 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
$referenceList = XmlSecurityEnc::createReferenceList($encryptedKey);
// token reference to encrypted key
$keyInfo = $this->createKeyInfo($filterHelper, self::TOKEN_REFERENCE_SECURITY_TOKEN, $guid);
$nodes = $this->createNodeListForEncryption($dom, $security);
$nodes = $this->createNodeListForEncryption($dom);
foreach ($nodes as $node) {
$type = XmlSecurityEnc::ELEMENT;
if ($node->localName == 'Body') {
@ -241,4 +237,4 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
}
}
}
}
}

View File

@ -14,11 +14,6 @@ namespace BeSimple\SoapServer;
use BeSimple\SoapCommon\FilterHelper;
use BeSimple\SoapCommon\Helper;
use BeSimple\SoapCommon\Mime\MultiPart as MimeMultiPart;
use BeSimple\SoapCommon\Mime\Parser as MimeParser;
use BeSimple\SoapCommon\Mime\Part as MimePart;
use BeSimple\SoapCommon\SoapRequest;
use BeSimple\SoapCommon\SoapRequestFilter;
use BeSimple\SoapCommon\SoapResponse;
use BeSimple\SoapCommon\SoapResponseFilter;
@ -72,4 +67,4 @@ class XmlMimeFilter implements SoapResponseFilter
}
}
}
}

View File

@ -14,7 +14,6 @@ namespace BeSimple\SoapWsdl\Dumper;
use BeSimple\SoapCommon\Definition\Definition;
use BeSimple\SoapCommon\Definition\Method;
use BeSimple\SoapCommon\Definition\Part;
use BeSimple\SoapCommon\Definition\Type\ArrayOfType;
use BeSimple\SoapCommon\Definition\Type\ComplexType;
@ -70,6 +69,7 @@ class Dumper
'version12_class' => 'BeSimple\\SoapWsdl\\Dumper\\Version12',
'version11_name' => $this->definition->getName(),
'version12_name' => $this->definition->getName().'12',
'stylesheet' => null,
);
$invalid = array();
@ -124,6 +124,8 @@ class Dumper
$this->document->formatOutput = true;
$this->addStylesheet();
return $this->document->saveXML();
}
@ -187,7 +189,7 @@ class Dumper
protected function addMessages(array $messages)
{
foreach ($messages as $message) {
if ($message->isEmpty()) {
if (preg_match('#Header$#', $message->getName()) && $message->isEmpty()) {
continue;
}
@ -283,7 +285,7 @@ class Dumper
$operation->setAttribute('name', $method->getName());
foreach (array('input' => $method->getInput(), 'output' => $method->getOutput(), 'fault' => $method->getFault()) as $type => $message) {
if ($message->isEmpty()) {
if ('fault' === $type && $message->isEmpty()) {
continue;
}
@ -298,6 +300,15 @@ class Dumper
return $operation;
}
protected function addStylesheet()
{
if ($this->options['stylesheet']) {
$stylesheet = $this->document->createProcessingInstruction('xml-stylesheet', sprintf('type="text/xsl" href="%s"', $this->options['stylesheet']));
$this->document->insertBefore($stylesheet, $this->document->documentElement);
}
}
protected function getVersion($version)
{
if (\SOAP_1_2 === $version) {