Skip to content

Commit 66d1863

Browse files
author
Gregor Becker
committed
Merge remote-tracking branch 'origin/master'
2 parents 71ab444 + 6e3bb76 commit 66d1863

File tree

17 files changed

+198
-187
lines changed

17 files changed

+198
-187
lines changed

config/soap.php

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
<?php
2-
3-
use RobRichards\XMLSecLibs\XMLSecurityKey;
4-
5-
return [
6-
7-
/*
8-
|--------------------------------------------------------------------------
9-
| SOAP Client Configuration
10-
|--------------------------------------------------------------------------
11-
|
12-
| Her you can setup your soap client by configuration so that ou just need
13-
| a name.
14-
|
15-
| example: Soap::buildClient('laravel_soap')
16-
*/
17-
18-
'clients' => [
19-
'laravel_soap' => [
20-
'base_wsdl' => 'test.wsdl',
21-
'with_wsa' => true,
22-
'with_basic_auth' => [
23-
'username' => 'username',
24-
'password' => 'password',
25-
],
26-
'with_wsse' => [
27-
'user_token_name' => 'username',
28-
'user_token_password' => 'password',
29-
'private_key_file' => 'path/to/privatekey.pem',
30-
'public_key_file' => 'path/to/publickey.pyb',
31-
'server_certificate_file' => 'path/to/client-cert.pem',
32-
'server_certificate_has_subject_key_identifier' => false,
33-
'user_token_digest' => false,
34-
'digital_sign_method' => XMLSecurityKey::RSA_SHA1,
35-
'timestamp' => 3600,
36-
'sign_all_headers' => false,
37-
]
38-
],
39-
],
40-
41-
];
1+
<?php
2+
3+
use RobRichards\XMLSecLibs\XMLSecurityKey;
4+
5+
return [
6+
7+
/*
8+
|--------------------------------------------------------------------------
9+
| SOAP Client Configuration
10+
|--------------------------------------------------------------------------
11+
|
12+
| Her you can setup your soap client by configuration so that ou just need
13+
| a name.
14+
|
15+
| example: Soap::buildClient('laravel_soap')
16+
*/
17+
18+
'clients' => [
19+
'laravel_soap' => [
20+
'base_wsdl' => 'test.wsdl',
21+
'with_wsa' => true,
22+
'with_basic_auth' => [
23+
'username' => 'username',
24+
'password' => 'password',
25+
],
26+
'with_wsse' => [
27+
'user_token_name' => 'username',
28+
'user_token_password' => 'password',
29+
'private_key_file' => 'path/to/privatekey.pem',
30+
'public_key_file' => 'path/to/publickey.pyb',
31+
'server_certificate_file' => 'path/to/client-cert.pem',
32+
'server_certificate_has_subject_key_identifier' => false,
33+
'user_token_digest' => false,
34+
'digital_sign_method' => XMLSecurityKey::RSA_SHA1,
35+
'timestamp' => 3600,
36+
'sign_all_headers' => false,
37+
],
38+
],
39+
],
40+
41+
];

src/Client/Request.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
use Illuminate\Support\Arr;
88

99
/**
10-
* Class Request
11-
* @package CodeDredd\Soap\Client
10+
* Class Request.
1211
*/
1312
class Request
1413
{
@@ -41,26 +40,30 @@ public function action(): string
4140
/**
4241
* @return \Psr\Http\Message\RequestInterface
4342
*/
44-
public function getRequest() {
43+
public function getRequest()
44+
{
4545
return $this->request;
4646
}
4747

4848
/**
49-
* Return complete xml request body
49+
* Return complete xml request body.
5050
*
5151
* @return string
5252
*/
53-
public function xmlContent() {
53+
public function xmlContent()
54+
{
5455
return $this->request->getBody()->getContents();
5556
}
5657

5758
/**
58-
* Return request arguments
59+
* Return request arguments.
5960
*
6061
* @return array
6162
*/
62-
public function arguments(): array {
63+
public function arguments(): array
64+
{
6365
$xml = SoapXml::fromString($this->xmlContent());
66+
6467
return Arr::first(XMLSerializer::domNodeToArray($xml->getBody()));
6568
}
6669
}

src/Client/Response.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
namespace CodeDredd\Soap\Client;
44

5-
use LogicException;
65
use ArrayAccess;
76
use CodeDredd\Soap\Exceptions\RequestException;
87
use CodeDredd\Soap\Xml\SoapXml;
98
use GuzzleHttp\Psr7\Response as Psr7Response;
109
use Illuminate\Support\Str;
1110
use Illuminate\Support\Traits\Macroable;
11+
use LogicException;
1212
use Phpro\SoapClient\Type\ResultInterface;
1313

1414
/**
15-
* Class Response
16-
* @package CodeDredd\Soap\Client
15+
* Class Response.
1716
*/
1817
class Response implements ResultInterface, ArrayAccess
1918
{
@@ -65,7 +64,7 @@ public static function fromSoapFault(\SoapFault $soapFault)
6564
}
6665

6766
/**
68-
* Get the full SOAP enveloppe response
67+
* Get the full SOAP enveloppe response.
6968
*
7069
* @return string
7170
*/
@@ -96,8 +95,10 @@ public function body($transformXml = true, $sanitizeXmlFaultMessage = true)
9695
$body = (string) $this->response->getBody();
9796
if ($transformXml && Str::contains($body, '<?xml')) {
9897
$message = SoapXml::fromString($body)->getFaultMessage();
98+
9999
return trim($sanitizeXmlFaultMessage ? Str::after($message, 'Exception:') : $message);
100100
}
101+
101102
return $body;
102103
}
103104

@@ -195,7 +196,7 @@ public function offsetExists($offset)
195196
*/
196197
public function json()
197198
{
198-
if (!$this->decoded) {
199+
if (! $this->decoded) {
199200
$this->decoded = json_decode($this->body(), true);
200201
}
201202

src/Client/ResponseSequence.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function __invoke()
143143
throw new OutOfBoundsException('A request was made, but the response sequence is empty.');
144144
}
145145

146-
if (!$this->failWhenEmpty && count($this->responses) === 0) {
146+
if (! $this->failWhenEmpty && count($this->responses) === 0) {
147147
return value($this->emptyResponse ?? SoapFactory::response());
148148
}
149149

src/Driver/ExtSoap/ExtSoapDriver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class ExtSoapDriver extends PhproExtSoapDriver
1010
public static function createFromOptions(ExtSoapOptions $options): PhproExtSoapDriver
1111
{
1212
$client = AbusedClient::createFromOptions($options);
13+
1314
return self::createFromClient($client);
1415
}
1516
}

src/Exceptions/SoapException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
namespace CodeDredd\Soap\Exceptions;
44

55
/**
6-
* Class SoapException
7-
*
8-
* @package CodeDredd\Soap\Exceptions
6+
* Class SoapException.
97
*/
108
class SoapException extends \RuntimeException
119
{

src/Facades/Soap.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Illuminate\Support\Facades\Facade;
77

88
/**
9-
* Class Soap
9+
* Class Soap.
1010
*
1111
* @method static \CodeDredd\Soap\SoapClient baseWsdl(string $wsdl)
1212
* @method static \CodeDredd\Soap\SoapClient stub(callable $callback)
@@ -28,12 +28,11 @@
2828
* @method static assertActionCalled(string $action)
2929
* @method static assertNothingSent()
3030
* @method static assertSequencesAreEmpty()
31-
* @package CodeDredd\Soap
3231
*/
3332
class Soap extends Facade
3433
{
3534
/**
36-
* {@inheritDoc}
35+
* {@inheritdoc}
3736
*/
3837
protected static function getFacadeAccessor()
3938
{

src/Faker/EngineFaker.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
use Phpro\SoapClient\Soap\Handler\HandlerInterface;
1212
use Phpro\SoapClient\Soap\HttpBinding\LastRequestInfo;
1313
use Phpro\SoapClient\Soap\HttpBinding\SoapRequest;
14-
use Phpro\SoapClient\Xml\SoapXml;
1514

1615
/**
17-
* Class EngineFaker
18-
* @package CodeDredd\Soap\Faker
16+
* Class EngineFaker.
1917
*/
2018
class EngineFaker implements EngineInterface
2119
{

src/Middleware/WsseMiddleware.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
class WsseMiddleware extends Middleware
1414
{
15-
1615
/**
1716
* @var string
1817
*/
@@ -135,11 +134,11 @@ public function beforeRequest(callable $handler, RequestInterface $request): Pro
135134
$wsse->addTimestamp($this->timestamp);
136135

137136
// Add a user token if this is configured.
138-
if (!empty($this->userTokenName) && !empty($this->userTokenPassword)) {
137+
if (! empty($this->userTokenName) && ! empty($this->userTokenPassword)) {
139138
$wsse->addUserToken($this->userTokenName, $this->userTokenPassword, $this->userTokenDigest);
140139
}
141140

142-
if (!empty($this->privateKeyFile) && !empty($this->publicKeyFile)) {
141+
if (! empty($this->privateKeyFile) && ! empty($this->publicKeyFile)) {
143142
// Create new XMLSec Key using the dsigType and type is private key
144143
$key = new XMLSecurityKey($this->digitalSignMethod, ['type' => 'private']);
145144
$key->loadKey($this->privateKeyFile, true);
@@ -159,17 +158,18 @@ public function beforeRequest(callable $handler, RequestInterface $request): Pro
159158
$wsse->encryptSoapDoc($siteKey, $key, [
160159
'KeyInfo' => [
161160
'X509SubjectKeyIdentifier' => $this->serverCertificateHasSubjectKeyIdentifier,
162-
]
161+
],
163162
]);
164163
}
165164

166165
$request = $request->withBody($xml->toStream());
166+
167167
return $handler($request);
168168
}
169169

170170
public function afterResponse(ResponseInterface $response): ResponseInterface
171171
{
172-
if (!$this->encrypt) {
172+
if (! $this->encrypt) {
173173
return $response;
174174
}
175175

@@ -183,8 +183,8 @@ public function afterResponse(ResponseInterface $response): ResponseInterface
183183
'key' => $this->privateKeyFile,
184184
'isFile' => true,
185185
'isCert' => false,
186-
]
187-
]
186+
],
187+
],
188188
]
189189
);
190190

0 commit comments

Comments
 (0)