Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Handler/HttPlugHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace CodeDredd\Soap\Handler;

use CodeDredd\Soap\HttpBinding\Converter\Psr7Converter;
use Http\Client\Common\PluginClient;
use Http\Discovery\HttpClientDiscovery;
use Http\Discovery\MessageFactoryDiscovery;
Expand All @@ -11,7 +12,6 @@
use Phpro\SoapClient\Middleware\MiddlewareSupportingInterface;
use Phpro\SoapClient\Soap\Handler\HandlerInterface;
use Phpro\SoapClient\Soap\Handler\LastRequestInfoCollectorInterface;
use CodeDredd\Soap\HttpBinding\Converter\Psr7Converter;
use Phpro\SoapClient\Soap\HttpBinding\LastRequestInfo;
use Phpro\SoapClient\Soap\HttpBinding\SoapRequest;
use Phpro\SoapClient\Soap\HttpBinding\SoapResponse;
Expand Down
14 changes: 7 additions & 7 deletions src/HttpBinding/Builder/Psr7RequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,21 @@ public function setHeaders(array $headers)
}

/**
* Mark as SOAP 1.1
* Mark as SOAP 1.1.
*/
public function isSOAP11()
{
$this->soapVersion = self::SOAP11;
}

/**
* Mark as SOAP 1.2
* Mark as SOAP 1.2.
*/
public function isSOAP12()
{
$this->soapVersion = self::SOAP12;
}


/**
* @param string $soapAction
*/
Expand Down Expand Up @@ -152,11 +151,11 @@ public function setHttpMethod(string $method)
*/
private function validate()
{
if (!$this->endpoint) {
if (! $this->endpoint) {
throw new RequestException('There is no endpoint specified.');
}

if (!$this->hasSoapMessage && $this->httpMethod === 'POST') {
if (! $this->hasSoapMessage && $this->httpMethod === 'POST') {
throw new RequestException('There is no SOAP message specified.');
}

Expand All @@ -172,7 +171,7 @@ private function validate()
* SOAP 1.2 only defines HTTP binding with POST and GET methods.
* @link https://www.w3.org/TR/2007/REC-soap12-part0-20070427/#L10309
*/
if ($this->soapVersion === self::SOAP12 && !in_array($this->httpMethod, ['GET', 'POST'])) {
if ($this->soapVersion === self::SOAP12 && ! in_array($this->httpMethod, ['GET', 'POST'])) {
throw new RequestException('Invalid SOAP method specified for SOAP 1.2. Expeted: GET or POST.');
}
}
Expand Down Expand Up @@ -214,11 +213,12 @@ private function prepareSoap12Headers(): array
$headers = [];
if ($this->httpMethod !== 'POST') {
$headers['Accept'] = 'application/soap+xml';

return $headers;
}

$headers['Content-Length'] = (string) $this->soapMessage->getSize();
$headers['Content-Type'] = 'application/soap+xml; charset="utf-8"' . '; action="' . $this->soapAction . '"';
$headers['Content-Type'] = 'application/soap+xml; charset="utf-8"'.'; action="'.$this->soapAction.'"';

return $headers;
}
Expand Down
6 changes: 2 additions & 4 deletions src/HttpBinding/Converter/Psr7Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

namespace CodeDredd\Soap\HttpBinding\Converter;

use CodeDredd\Soap\HttpBinding\Builder\Psr7RequestBuilder;
use Http\Message\MessageFactory;
use Http\Message\StreamFactory;
use CodeDredd\Soap\HttpBinding\Builder\Psr7RequestBuilder;
use Phpro\SoapClient\Soap\HttpBinding\SoapRequest;
use Phpro\SoapClient\Soap\HttpBinding\SoapResponse;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

/**
* Class Psr7Converter
*
* @package CodeDredd\Soap\HttpBinding\Converter
* Class Psr7Converter.
*/
class Psr7Converter
{
Expand Down
2 changes: 1 addition & 1 deletion src/SoapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use CodeDredd\Soap\Driver\ExtSoap\ExtSoapEngineFactory;
use CodeDredd\Soap\Exceptions\NotFoundConfigurationException;
use CodeDredd\Soap\Exceptions\SoapException;
use CodeDredd\Soap\Handler\HttPlugHandle;
use CodeDredd\Soap\Middleware\WsseMiddleware;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
Expand All @@ -20,7 +21,6 @@
use Phpro\SoapClient\Soap\Driver\ExtSoap\ExtSoapOptions;
use Phpro\SoapClient\Soap\Engine\EngineInterface;
use Phpro\SoapClient\Soap\Handler\HandlerInterface;
use CodeDredd\Soap\Handler\HttPlugHandle;
use Phpro\SoapClient\Type\ResultInterface;
use Phpro\SoapClient\Type\ResultProviderInterface;
use Phpro\SoapClient\Util\XmlFormatter;
Expand Down